Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 165


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)?

Show Answer
Correct Answer: A

When referencing a module stored in Git, the correct way to specify a tag such as v1.0.0 is by appending the ?ref=v1.0.0 argument to the source path. This tells the system to use the specific tag or version of the module from the Git repository.

Discussion

6 comments
Sign in to comment
RVivekOption: A
Mar 27, 2024

If the source is from terrform registry then we can use version = "1.0.0" when using git as the source we have to use ?ref=1.0.0 the exact git path givin in the question is given in this terraform official documentation please check https://www.terraform.io/language/modules/sources#selecting-a-revision

BaburTurkOption: A
Jun 22, 2024

example source = "git::https://example.com/vpc.git?ref=v1.2.0"

BurakkoOption: B
Mar 2, 2024

Use the version argument in the module block to specify versions: Example: module "consul" { source = "hashicorp/consul/aws" version = "0.0.5" servers = 3 }

Linus11
Apr 5, 2024

This is about version stored in GIT, not in consul.

donathonOption: A
Mar 6, 2024

https://www.terraform.io/language/modules/sources#selecting-a-revision

dinesh198728Option: A
Mar 10, 2024

A is correct

zyxphreezOption: A
Mar 9, 2024

as Donathon said.... https://www.terraform.io/language/modules/sources#selecting-a-revision please check the module repository is GIT.... Burakko answer is incorrect

Burakko
Mar 10, 2024

There was exactly the same question earlier. This was the answer. however if you I ask me, both answers must be correct. Because they both work.