TA-002-P · Question #360
What does this code do?
The correct answer is A. Requires any version of the AWS provider > = 3.0 and < 4.0. The ~> operator in Terraform is the 'pessimistic constraint operator.' When written as ~> 3.0, it means the rightmost version component (the minor version, 0) is allowed to increment, but the leftmost component (the major version, 3) is pinned. This translates to >= 3.0 and <…
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
(28 responses)- A89% (25)
- B7% (2)
- C4% (1)
Explanation
The ~> operator in Terraform is the 'pessimistic constraint operator.' When written as ~> 3.0, it means the rightmost version component (the minor version, 0) is allowed to increment, but the leftmost component (the major version, 3) is pinned. This translates to >= 3.0 and < 4.0. It allows 3.1, 3.2, 3.9, etc., but excludes 4.0. If it were written as ~> 3.0.0, it would pin both major and minor versions, allowing only patch updates (e.g., 3.0.1, 3.0.9 but not 3.1.0). Answer A is correct.
Topics
Community Discussion
No community discussion yet for this question.