When using a module block to reference a module stored on the public Terraform Module Registry, how do you specify version 1.0.0?

Prepare for your Terraform Associate Exam with our engaging quiz. Test your knowledge with multiple choice questions and receive detailed explanations to enhance your understanding. Ace your exam with confidence!

When referencing a module stored on the public Terraform Module Registry, including the version attribute in the module block is the correct approach to specify which version to use. By adding the 'version = "1.0.0"' attribute, you are explicitly instructing Terraform to utilize that specific version of the module. This ensures compatibility, as different versions of a module might have different configurations, features, or fixes.

Using version control in this manner allows for better management of infrastructure as code, as it prevents unexpected changes or behavior that could arise if a module were to update automatically to a newer version without your knowledge.

In contrast, other options do not conform to how module versions are specified in Terraform. For instance, specifying 'id = "1.0.0"' is not a recognized syntax for defining module versions. Using a variable to indicate the version of a module may introduce complexity and may not guarantee that the exact version is utilized. Comments do not affect the execution of Terraform, so adding a versioning notice there wouldn't have any impact on the module reference.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy