In Terraform, which form of the required_providers block correctly specifies a minimum version?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

In Terraform, which form of the required_providers block correctly specifies a minimum version?

Explanation:
Terraform expects the version constraint in required_providers to be a string value, and to enforce a lower bound you place the operator >= inside that string. Using version = ">= 3.1" clearly states that any version 3.1 or higher is acceptable. The other forms are invalid or have different meanings: omitting quotes isn’t valid HCL syntax for a string value, and using a pessimistic constraint like ~> 3.1 restricts upgrades to the 3.1.x line (not all versions ≥ 3.1), while ~> 3.0 restricts to 3.0.x. Therefore, the correct form is version = ">= 3.1".

Terraform expects the version constraint in required_providers to be a string value, and to enforce a lower bound you place the operator >= inside that string. Using version = ">= 3.1" clearly states that any version 3.1 or higher is acceptable. The other forms are invalid or have different meanings: omitting quotes isn’t valid HCL syntax for a string value, and using a pessimistic constraint like ~> 3.1 restricts upgrades to the 3.1.x line (not all versions ≥ 3.1), while ~> 3.0 restricts to 3.0.x. Therefore, the correct form is version = ">= 3.1".

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy