Terraform

How to use a module?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

The general syntax is:

module "" {
  source  = ""
  version = ">= 1.2.0, < 2.0.0"

  # module inputs
}

The critical part is the source which you use to tell Terraform where the module can be found. When the module comes from the registry, you can pin the version; for local paths omit that attribute.