nerdexam
HashiCorp

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.

Read, generate, and modify configuration

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)
  • A
    88% (44)
  • B
    2% (1)
  • C
    4% (2)
  • D
    6% (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.

ATerraform 0.12 introduced substantial changes to the syntax used to write TerraformCorrect

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.

BThe user wants to ensure that the application being deployed is a minimum version of

The snippet typically refers to the Terraform CLI version, not the version of an application being deployed by Terraform.

Cthis ensures that all Terraform providers are above a certain version to match the

While providers have versions, the `required_version` in the `terraform` block primarily specifies the Terraform CLI version, not directly provider versions.

Dversions before Terraform 0.12 were not approved by HashiCorp to be used in production

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

#Terraform versions#HCL syntax#Configuration compatibility#Terraform 0.12

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice