Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 52


In Terraform 0.13 and above, outside of the required_providers block, Terraform configurations always refer to providers by their local names.

Show Answer
Correct Answer: A

In Terraform 0.13 and above, outside of the required_providers block, Terraform configurations always refer to providers by their local names. Local names are assigned when requiring a provider within a module and are used consistently throughout the Terraform configuration. This ensures that each module has a clear and consistent way to reference the providers it depends on, helping to manage dependencies and configurations effectively.

Discussion

8 comments
Sign in to comment
BereOption: A
Feb 7, 2024

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.

EltoothOption: A
Dec 27, 2022

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

bigboi23Option: A
Nov 18, 2022

Correct! https://www.terraform.io/language/providers/requirements

Chehh
Feb 23, 2023

"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

AShahine21Option: B
Jun 25, 2023

what about alias ? I am going to say false

campsOption: A
Sep 30, 2023

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.

Power123
Oct 1, 2023

A is correct

BJ5Option: B
Oct 7, 2024

What about aliases provider "aws" { region="us-west-1" alias = "west" } resource "aws_instance" "ec2" { provider = aws.west }

chaoscreater
Nov 26, 2024

that's still referencing the provider name "aws" first