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.
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit