Rationale for Correct Answer (B):
Provider version constraints in Terraform are specified using the version argument in the required_providers block, e.g.:
terraform {
required_providers {
aws = {
source = " hashicorp/aws "
version = " 3.1 "
}
}
}
This ensures Terraform always uses a specific provider version (or constraint expression).
Analysis of Incorrect Options:
A. version: Incomplete, no value specified.
C. version: 3.1: Incorrect syntax, Terraform uses = not :.
D. version - 3.1: Incorrect syntax, - is invalid here.
Key Concept:
Defining provider version constraints ensures consistent provider behavior across environments and avoids breaking changes.
[Reference:Terraform Exam Objective – Manage Terraform Resources and Providers., , , , , ]
Submit