TA-002-P · Question #313
Why might a user opt to include the following snippet in their configuration file?
The correct answer is A. Terraform 0.12 introduced substantial changes to the syntax used to write Terraform. The required_version setting in a Terraform configuration is often used to specify a minimum Terraform CLI version due to significant breaking changes introduced in Terraform 0.12.
Question
Why might a user opt to include the following snippet in their configuration file?
Options
- ATerraform 0.12 introduced substantial changes to the syntax used to write Terraform
- BThe user wants to ensure that the application being deployed is a minimum version of
- Cthis ensures that all Terraform providers are above a certain version to match the
- Dversions before Terraform 0.12 were not approved by HashiCorp to be used in production
How the community answered
(50 responses)- A88% (44)
- B2% (1)
- C4% (2)
- D6% (3)
Why each option
The `required_version` setting in a Terraform configuration is often used to specify a minimum Terraform CLI version due to significant breaking changes introduced in Terraform 0.12.
Terraform 0.12 introduced a major rewrite of the Terraform language, bringing substantial changes to syntax, type system, and expression evaluation. Users typically include a `required_version = ">= 0.12"` constraint in their configuration to ensure compatibility and prevent execution with older, incompatible Terraform CLI versions.
The snippet typically refers to the Terraform CLI version, not the version of an application being deployed by Terraform.
While providers have versions, the `required_version` in the `terraform` block primarily specifies the Terraform CLI version, not directly provider versions.
HashiCorp does not generally disapprove older versions for production use; the main reason for version constraints is feature and syntax compatibility.
Concept tested: Terraform required_version and 0.12 syntax changes
Source: https://developer.hashicorp.com/terraform/language/settings/terraform#version-constraints
Topics
Community Discussion
No community discussion yet for this question.