nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #194

A module block is shown in the Exhibit space of this page. When you use a module block to reference a module from the Terraform Registry such as the one in the example, how do you specify version 1.0.

The correct answer is C. Add a version = "1.0.0" attribute to the module block.. When referencing a module from the Terraform Registry, you pin a specific version by adding a version argument directly in the module block - for example, version = "1.0.0". The Terraform Registry fully supports module versioning and version constraints. The ?ref= syntax applies

Submitted by lars.no· Apr 18, 2026Work with Terraform Modules

Question

A module block is shown in the Exhibit space of this page. When you use a module block to reference a module from the Terraform Registry such as the one in the example, how do you specify version 1.0.0 of the module?

Options

  • AAppend ?ref=v1.0.0 argument to the source path.
  • BYou cannot. Modules stored on the public Terraform Registry do not support versioning.
  • CAdd a version = "1.0.0" attribute to the module block.
  • DNothing. Modules stored on the public Terraform module Registry always default to version

How the community answered

(59 responses)
  • A
    5% (3)
  • B
    3% (2)
  • C
    90% (53)
  • D
    2% (1)

Explanation

When referencing a module from the Terraform Registry, you pin a specific version by adding a version argument directly in the module block - for example, version = "1.0.0". The Terraform Registry fully supports module versioning and version constraints. The ?ref= syntax applies to Git-based module sources, not Registry modules. Omitting the version argument causes Terraform to use the latest available version, which is generally unsafe for production.

Topics

#Terraform Modules#Module Versioning#Terraform Registry#Module Block Syntax

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice