nerdexam
HashiCorp

TA-002-P · Question #424

Which of the following is not valid source path for specifying a module?

The correct answer is A. source = "./modulelversion=v1.0.0". Terraform module source paths have specific formats for local paths, version control repositories, and Terraform Registry, and adding version= directly to a local path is not a valid syntax.

Interact with Terraform modules

Question

Which of the following is not valid source path for specifying a module?

Options

  • Asource = "./modulelversion=v1.0.0"
  • Bsource = "github.com/hashicorp/example?ref=v1.0.0"
  • Csource = "./module"
  • Dsource = "hashicorp/consul/aws"

How the community answered

(33 responses)
  • A
    91% (30)
  • C
    6% (2)
  • D
    3% (1)

Why each option

Terraform module source paths have specific formats for local paths, version control repositories, and Terraform Registry, and adding `version=` directly to a local path is not a valid syntax.

Asource = "./modulelversion=v1.0.0"Correct

The `version=` query parameter is not a valid way to specify a module version directly within a local path source string; local paths should only contain the directory path.

Bsource = "github.com/hashicorp/example?ref=v1.0.0"

This is a valid syntax for referencing a module in a Git repository (like GitHub) with a specific reference (tag or branch) using a query parameter.

Csource = "./module"

This is a valid syntax for referencing a local module by its relative path within the file system.

Dsource = "hashicorp/consul/aws"

This is a valid syntax for referencing a module hosted on the Terraform Registry, using the registry's address format.

Concept tested: Terraform module source syntax

Source: https://developer.hashicorp.com/terraform/language/modules/sources

Topics

#Module sources#Terraform modules#Module addressing#Configuration syntax

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice