nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #45

What does this code do?

The correct answer is A. Requires any version of the AWS provider > = 3.0 and <4.0. Although the code block is not visible in the question, the correct answer (A) points to the behavior of the pessimistic constraint operator ~> in Terraform. A constraint written as ~> 3.0 means 'any version >= 3.0 and < 4.0' - it allows patch and minor updates within the 3.x lin

Submitted by amina.ke· Apr 18, 2026Understand Terraform Providers

Question

What does this code do?

Options

  • ARequires any version of the AWS provider > = 3.0 and <4.0
  • BRequires any version of the AWS provider >= 3.0
  • CRequires any version of the AWS provider after the 3.0 major release, like 4.1
  • DRequires any version of the AWS provider > 3.0

How the community answered

(59 responses)
  • A
    92% (54)
  • B
    5% (3)
  • C
    2% (1)
  • D
    2% (1)

Explanation

Although the code block is not visible in the question, the correct answer (A) points to the behavior of the pessimistic constraint operator ~> in Terraform. A constraint written as ~> 3.0 means 'any version >= 3.0 and < 4.0' - it allows patch and minor updates within the 3.x line but prevents a major version bump to 4.x. This is the most common safe versioning pattern. >= 3.0 alone (option B) would allow version 4.x or higher, which could introduce breaking changes. The ~> operator is key to understanding this constraint.

Topics

#Provider versioning#Version constraints#Optimistic constraint operator#Terraform providers

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice