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)?
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)?
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.
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
example source = "git::https://example.com/vpc.git?ref=v1.2.0"
A is correct
https://www.terraform.io/language/modules/sources#selecting-a-revision
Use the version argument in the module block to specify versions: Example: module "consul" { source = "hashicorp/consul/aws" version = "0.0.5" servers = 3 }
This is about version stored in GIT, not in consul.
as Donathon said.... https://www.terraform.io/language/modules/sources#selecting-a-revision please check the module repository is GIT.... Burakko answer is incorrect
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.