Terraform-Associate-004 practice question 8 of 35
Module version is required to reference a module on the Terraform Module Registry.
Full set: 360 questionsThe 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.
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.
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.
Keep practicing
Take the free Terraform-Associate-004 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Terraform-Associate-004 practice questions
- Question 1You should run terraform fnt to rewrite all Terraform configurations within the current w…
- Question 2Module variable assignments are inherited from the parent module and you do not need to e…
- Question 3terraform validate confirms thesyntaxof Terraform files.
- Question 4Using the terraform state rm command against a resource will destroy it.
- Question 5Variables declared within a module are accessible outside of the module.
- Question 6terraform init retrieves and caches the configuration for all remote modules.
