TA-002-P · Question #183
Refer below code where pessimistic constraint operator has been used to specify a version of a provider. terraform { required_providers { aws = "~> 1.1.0" }} Which of the following options are valid…
The correct answer is A. 1.1.1 C. 1.1.8. The pessimistic constraint operator (~>) with a three-part version like ~> 1.1.0 means 'allow only patch-level changes within the 1.1.x series.' Formally, it is equivalent to >= 1.1.0 and < 1.2.0. Therefore: 1.1.1 (A) - valid, it is within the 1.1.x range; 1.1.8 (C) - valid…
Question
Refer below code where pessimistic constraint operator has been used to specify a version of a provider. terraform { required_providers { aws = "~> 1.1.0" }} Which of the following options are valid provider versions that satisfy the above constraint. (select two)
Options
- A1.1.1
- B1.2.9
- C1.1.8
- D1.2.0
How the community answered
(27 responses)- A89% (24)
- B7% (2)
- D4% (1)
Explanation
The pessimistic constraint operator (~>) with a three-part version like ~> 1.1.0 means 'allow only patch-level changes within the 1.1.x series.' Formally, it is equivalent to >= 1.1.0 and < 1.2.0. Therefore: 1.1.1 (A) - valid, it is within the 1.1.x range; 1.1.8 (C) - valid, also within 1.1.x. 1.2.9 (B) and 1.2.0 (D) both exceed the 1.2.0 upper boundary and are therefore rejected. If the constraint had been ~> 1.1 (only two parts), it would allow up to < 2.0.0.
Topics
Community Discussion
No community discussion yet for this question.