Here's an example that demonstrates this:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
provider "aws" {
region = "us-west-2"
}
resource "aws_instance" "example" {
ami = "ami-0123456789abcdef0"
instance_type = "t2.micro"
}
In this example, the required_providers block specifies the source and version constraints for the AWS provider. In the rest of the configuration, the provider is referred to by its local name aws, such as in the provider "aws" block and the aws_instance resource block.
A is correct answer.
"Local names are module-specific, and are assigned when requiring a provider. Local names must be unique per-module.
Outside of the required_providers block, Terraform configurations always refer to providers by their local names."
https://www.terraform.io/language/providers/requirements#local-names
A. True.
In Terraform 0.13 and above, provider references are always specified using their local name, rather than the legacy name-based syntax used in earlier versions. The provider's local name is specified in the required_providers block, and this local name is used in all provider references in the configuration.
"Outside of the required_providers block, Terraform configurations always refer to providers by their local names."
https://www.terraform.io/language/providers/requirements#local-names
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Bere
Highly Voted 1 year, 3 months agoEltooth
Highly Voted 2 years, 4 months agoBJ5
Most Recent 7 months, 2 weeks agochaoscreater
6 months agocamps
1 year, 7 months agoPower123
1 year, 7 months agoAShahine21
1 year, 11 months agoChehh
2 years, 3 months agobigboi23
2 years, 6 months ago