0
0
Terraformcloud~5 mins

Multiple provider configurations in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of using multiple provider configurations in Terraform?
Multiple provider configurations allow Terraform to manage resources across different accounts, regions, or cloud providers within the same configuration.
Click to reveal answer
beginner
How do you define an additional provider configuration in Terraform?
You define an additional provider by giving it an alias inside the provider block, for example:
provider "aws" { alias = "west" region = "us-west-2" }
Click to reveal answer
beginner
How do you specify which provider configuration a resource should use?
You specify the provider by using the 'provider' argument inside the resource block, referencing the provider alias, for example:
resource "aws_instance" "example" { provider = aws.west }
Click to reveal answer
intermediate
Can you use multiple providers of the same type in one Terraform configuration?
Yes, by using aliases you can configure multiple providers of the same type to manage resources in different regions or accounts.
Click to reveal answer
intermediate
What happens if you do not specify a provider alias for a resource when multiple providers are configured?
Terraform uses the default provider configuration without an alias. If multiple providers exist, resources without a specified provider use the default one.
Click to reveal answer
How do you create a second AWS provider configuration for the us-east-1 region?
Aprovider "aws-east" { region = "us-east-1" }
Bprovider "aws" { region = "us-east-1" }
Cprovider "aws" { alias = "east" region = "us-east-1" }
Dresource "aws" { alias = "east" region = "us-east-1" }
How do you tell a resource to use the aliased provider 'aws.west'?
Aalias = aws.west
Bprovider = "aws.west"
Cprovider = aws-west
Dprovider = aws.west
What is the default provider configuration called in Terraform?
Adefault
Bno alias
Cunnamed
Dmain
Can you use multiple providers of different cloud types in one Terraform configuration?
AYes, Terraform supports multiple providers including different clouds.
BNo, only one cloud provider per configuration is allowed.
COnly if they share the same API version.
DOnly if they are from the same vendor.
What is the benefit of using multiple provider configurations?
AManage resources across multiple accounts or regions easily.
BReduce Terraform execution time.
CAutomatically backup state files.
DEncrypt resource data.
Explain how to configure and use multiple AWS providers in Terraform.
Think about how you tell Terraform which AWS region or account to use for each resource.
You got /3 concepts.
    Describe what happens if you have multiple provider configurations but a resource does not specify which one to use.
    Consider the provider without an alias as the fallback.
    You got /3 concepts.