When using a module block to reference a module stored on the public Terraform Module Registry such as:
How do you specify version 1.0.0?
When using a module block to reference a module stored on the public Terraform Module Registry such as:
How do you specify version 1.0.0?
To specify version 1.0.0 of a module stored on the public Terraform Module Registry, you need to add the version attribute within the module block. This ensures that the desired module version is used and prevents unexpected updates. The correct syntax for specifying version 1.0.0 is as follows: module "consul" { source = "hashicorp/consul/aws" version = "1.0.0" }. This approach is recommended to maintain consistency and control over module versions.
C correct answer Version When using modules installed from a module registry, we recommend explicitly constraining the acceptable version numbers to avoid unexpected or unwanted changes. Use the version argument in the module block to specify versions: module "consul" { source = "hashicorp/consul/aws" version = "0.0.5" servers = 3 }
C is correct answer. The version argument accepts a version constraint string. Terraform will use the newest installed version of the module that meets the constraint; if no acceptable versions are installed, it will download the newest version that meets the constraint. Version constraints are supported only for modules installed from a module registry, such as the public Terraform Registry or Terraform Cloud's private module registry. Other module sources can provide their own versioning mechanisms within the source string itself, or might not support versions at all. In particular, modules sourced from local file paths do not support version; since they're loaded from the same source repository, they always share the same version as their caller. https://www.terraform.io/language/modules/syntax#version
C is correct https://www.terraform.io/language/modules/syntax
Example: module "consul" { source = "hashicorp/consul/aws" version = "1.0.0" // other necessary arguments... }
Although please note that version is now deprecated in favour of the required_providers block https://developer.hashicorp.com/terraform/language/providers/configuration#version-deprecated
Ok sorry my bad this is a module not a provider so that's not relevant (but still good to know though :) ) Answer is still C
example from HashiCorp: module "consul" { source = "hashicorp/consul/aws" version = "0.0.5" servers = 3 }
CCCCCC
C is the correct answer. It is used to lock down version of the modules in production grade infrastructure templates.
C is correct
C is correct