Terraform-Associate-004 practice question 8 of 35

Module version is required to reference a module on the Terraform Module Registry.

Full set: 360 questions
Answer options
A: True
B: False
Correct Answer:
FALSE
Explanation

The version argument within a module block is not required when referencing a module from the Terraform Module Registry. While specifying a version is a strongly recommended best practice to ensure configuration stability and prevent breaking changes from new module releases, it is an optional argument. If the version argument is omitted, Terraform will automatically download and use the latest available version of the module.

Why Incorrect

The statement is "True" is incorrect because the version argument is explicitly defined as optional in the Terraform language specification for module blocks. Terraform has a default behavior (use the latest version) when the argument is not present, which confirms it is not a mandatory requirement for the configuration to be valid.

References

1. HashiCorp Terraform Documentation, "Module Sources": In the section titled "Terraform Registry," the documentation states: "The version argument is optional. If omitted, Terraform will download the latest version of the module that is compatible with the other constraints in the configuration." This directly confirms that the argument is not required.

2. HashiCorp Terraform Documentation, "The module Block": In the description of the version meta-argument, the documentation says: "We recommend explicitly constraining the module version to avoid unexpected or unwanted changes." The use of the word "recommend" indicates that it is a best practice, not a requirement.

3. HashiCorp Learn, "Use Modules from the Terraform Registry": This tutorial explains the components of a module block sourced from the registry. It describes the version argument as a way to "tell Terraform which version of the module to use" and recommends setting it, but does not state it is a requirement for the block to function.

Scroll to Top