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
Question
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)- A92% (54)
- B5% (3)
- C2% (1)
- D2% (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
Community Discussion
No community discussion yet for this question.