0
0
Terraformcloud~20 mins

Provider aliases for multi-region in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-Region Provider Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
Identify the correct provider alias configuration for AWS multi-region
Given the need to deploy resources in two AWS regions using Terraform provider aliases, which configuration correctly defines the provider aliases for us-east-1 and us-west-2?
A
provider "aws" {
  region = "us-east-1"
  alias  = "east"
}

provider "aws" {
  region = "us-west-2"
  alias  = "west"
}
B
provider "aws" {
  alias  = "east"
  region = "us-east-1"
}

provider "aws" {
  alias  = "west"
  region = "us-west-2"
}
C
provider "aws" {
  region = "us-east-1"
}

provider "aws" {
  region = "us-west-2"
  alias  = "west"
}
D
provider "aws" {
  region = "us-east-1"
  alias  = "east"
}

provider "aws" {
  region = "us-west-2"
}
Attempts:
2 left
💡 Hint
Remember that each provider block for a different region must have a unique alias.
service_behavior
intermediate
2:00remaining
Determine the provider used for resource creation with aliases
Given the following Terraform resource and provider aliases, which provider configuration will be used to create the resource aws_instance.example?
Terraform
provider "aws" {
  region = "us-east-1"
  alias  = "east"
}

provider "aws" {
  region = "us-west-2"
  alias  = "west"
}

resource "aws_instance" "example" {
  provider = aws.west
  ami           = "ami-12345678"
  instance_type = "t2.micro"
}
AThe AWS provider configured for region us-east-1
BTerraform will raise an error due to missing provider
CThe default AWS provider without alias
DThe AWS provider configured for region us-west-2
Attempts:
2 left
💡 Hint
Check the provider attribute in the resource block.
Architecture
advanced
3:00remaining
Best practice for managing multiple provider aliases in large Terraform projects
In a large Terraform project managing resources across multiple AWS regions, which approach best organizes provider aliases to ensure maintainability and clarity?
ADefine all provider aliases in a single providers.tf file and reference them explicitly in each module
BAvoid using provider aliases and create separate Terraform projects per region
CUse a single default provider without aliases and switch regions dynamically in resource blocks
DDefine provider aliases inside each module separately without sharing them across modules
Attempts:
2 left
💡 Hint
Consider how to keep provider configurations centralized and reusable.
security
advanced
2:30remaining
Security implications of provider alias misconfiguration in multi-region deployments
What is a potential security risk if provider aliases are misconfigured in Terraform when deploying resources across multiple AWS regions?
AProvider aliases do not affect security, only resource naming
BTerraform will automatically encrypt all resources regardless of region
CResources may be created in unintended regions, exposing data to unauthorized zones
DMisconfiguration causes Terraform to block deployment until fixed
Attempts:
2 left
💡 Hint
Think about where your resources actually get created.
🧠 Conceptual
expert
3:00remaining
Understanding provider alias inheritance in nested modules
Consider a root Terraform module defining two AWS provider aliases: east and west. A child module is called without explicitly passing providers. Which provider configuration will the child module use for AWS resources?
Terraform
provider "aws" {
  region = "us-east-1"
  alias  = "east"
}

provider "aws" {
  region = "us-west-2"
  alias  = "west"
}

module "child" {
  source = "./child_module"
  # no providers passed explicitly
}

# Inside child_module, resource uses default provider aws
AThe AWS provider with alias "east" from the root module
BThe default AWS provider without alias, causing an error since none is defined
CThe AWS provider with alias "west" from the root module
DTerraform automatically merges both provider aliases for the child module
Attempts:
2 left
💡 Hint
Think about how provider inheritance works when no default provider is defined.