nerdexam
HashiCorp

TA-002-P · Question #274

When using constraint expressions to signify a version of a provider, which of the following are valid provider versions that satisfy the expression found in the following code snippet: (select two)…

The correct answer is B. 1.2.3 C. 1.2.9. The ~> (pessimistic constraint) operator with a version like ~> 1.2.0 allows only patch-level version increments within the 1.2.x series. It is equivalent to >= 1.2.0, < 1.3.0. Therefore: 1.2.3 (B) is valid - it is within the 1.2.x range. 1.2.9 (C) is valid - it is also within…

Read, generate, and modify configuration

Question

When using constraint expressions to signify a version of a provider, which of the following are valid provider versions that satisfy the expression found in the following code snippet: (select two) 1. terraform 2. { 3. required_providers 4. { 5. aws = "~> 1.2.0" 6. } 7. }

Options

  • A1.3.1
  • B1.2.3
  • C1.2.9
  • D1.3.0

How the community answered

(47 responses)
  • A
    9% (4)
  • B
    72% (34)
  • D
    19% (9)

Explanation

The ~> (pessimistic constraint) operator with a version like ~> 1.2.0 allows only patch-level version increments within the 1.2.x series. It is equivalent to >= 1.2.0, < 1.3.0. Therefore: 1.2.3 (B) is valid - it is within the 1.2.x range. 1.2.9 (C) is valid - it is also within the 1.2.x range. 1.3.0 (D) is invalid - it is at the boundary and the constraint is strictly less than 1.3.0. 1.3.1 (A) is invalid - it exceeds the 1.2.x ceiling. If the constraint were ~> 1.2 (without the patch digit), it would allow up to < 2.0, but the .0 patch digit locks it to the 1.2.x series only.

Topics

#Provider versioning#Version constraints#Optimistic operator#Configuration syntax

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice