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.
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)- A91% (30)
- C6% (2)
- D3% (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.
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.
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.
This is a valid syntax for referencing a local module by its relative path within the file system.
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
Community Discussion
No community discussion yet for this question.