A Terraform engineer wants to reuse a set of resource definitions across multiple environments without duplicating code. The engineer should package the configuration as a module stored in a private registry. When calling the module, which argument specifies the module's source location in a Terraform Registry?

  1. source ✓
  2. module_path
  3. registry
  4. provider

Correct answer: source

Option A is correct because the 'source' meta-argument in a module block tells Terraform where to find the module, including paths to Terraform Registry entries such as 'namespace/module-name/provider'. Option B, module_path, is not a valid Terraform argument; it does not exist in the Terraform language specification. Option C, registry, is not a recognized meta-argument in a module block; the registry location is embedded within the source string itself. Option D, provider, is used to pass a specific provider configuration to a module but does not specify the module's location.

Topic: · terraform modules, module registry, source argument, infrastructure as code

Practice HashiCorp Terraform Associate (003) Questions Free