nerdexam
HashiCorpHashiCorp

TA-002-P · Question #399

TA-002-P Question #399: Real Exam Question with Answer & Explanation

The correct answer is A: Append ref=v1. 0. 0 argument to the source path Most Voted. When referencing a Terraform module stored in a Git repository, a specific tag or commit is selected by appending a ref query parameter to the source URL.

Interact with Terraform modules

Question

Which is the best way to specify a tag of v1.0.0 when referencing a module stored in Git (for example git::https://example.com/vpc.git)?

Options

  • AAppend ref=v1. 0. 0 argument to the source path Most Voted
  • BAdd version = "1.0.0" parameter to module block
  • CNothing " modules stored on GitHub always default to version 1.0.0
  • DModules stored on GitHub do not support versioning

Explanation

When referencing a Terraform module stored in a Git repository, a specific tag or commit is selected by appending a ref query parameter to the source URL.

Common mistakes.

  • B. The 'version' parameter in a module block is only valid for modules sourced from the Terraform Registry - Git-based sources use the ref URL query argument instead.
  • C. Git-sourced modules do not default to any fixed version automatically; without a ref argument, Terraform uses the repository's default branch, not a pinned version.
  • D. Git-sourced modules fully support versioning through the ref query argument, making this statement factually incorrect.

Concept tested. Pinning Git module source to a specific version tag

Reference. https://developer.hashicorp.com/terraform/language/modules/sources#selecting-a-revision

Topics

#Terraform modules#Git module source#Module versioning#Source URL syntax

Community Discussion

No community discussion yet for this question.

Full TA-002-P PracticeBrowse All TA-002-P Questions