0
0
Terraformcloud~10 mins

Provider aliases for multi-region in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a provider with an alias for the us-east-1 region.

Terraform
provider "aws" {
  region = "[1]"
  alias  = "useast1"
}
Drag options to blanks, or click blank then click option'
Aus-east-1
Bus-west-2
Ceu-central-1
Dap-southeast-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using the default region instead of the specific region for the alias.
Misspelling the region name.
2fill in blank
medium

Complete the resource block to use the aliased provider for us-east-1.

Terraform
resource "aws_s3_bucket" "example" {
  provider = aws.[1]
  bucket   = "my-bucket-us-east-1"
  acl      = "private"
}
Drag options to blanks, or click blank then click option'
Auswest2
Bdefault
Cuseast1
Deucentral1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' which refers to the default provider, not the alias.
Using a region name instead of the alias.
3fill in blank
hard

Fix the error in the provider block by completing the missing alias.

Terraform
provider "aws" {
  region = "eu-west-1"
  alias  = "[1]"
}
Drag options to blanks, or click blank then click option'
Aeuwest1
Bdefault
Capne1
Duseast1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' as an alias which is reserved for the default provider.
Using an alias unrelated to the region.
4fill in blank
hard

Fill both blanks to define two providers with aliases for different regions.

Terraform
provider "aws" {
  region = "[1]"
  alias  = "uswest2"
}

provider "aws" {
  region = "[2]"
  alias  = "apne1"
}
Drag options to blanks, or click blank then click option'
Aus-west-2
Bap-northeast-1
Cus-east-1
Deu-west-1
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up region codes and aliases.
Using the same alias for both providers.
5fill in blank
hard

Fill all three blanks to create resources using aliased providers for multi-region deployment.

Terraform
resource "aws_s3_bucket" "west_bucket" {
  provider = aws.[1]
  bucket   = "my-bucket-west"
  acl      = "private"
}

resource "aws_s3_bucket" "asia_bucket" {
  provider = aws.[2]
  bucket   = "my-bucket-asia"
  acl      = "private"
}

resource "aws_s3_bucket" "default_bucket" {
  provider = [3]
  bucket   = "my-bucket-default"
  acl      = "private"
}
Drag options to blanks, or click blank then click option'
Auswest2
Bapne1
Caws
Duseast1
Attempts:
3 left
💡 Hint
Common Mistakes
Using region codes instead of aliases in the provider attribute.
Assigning the same alias to multiple resources incorrectly.