0
0
Terraformcloud~10 mins

Multiple provider configurations 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 specify the AWS provider region.

Terraform
provider "aws" {
  region = "[1]"
}
Drag options to blanks, or click blank then click option'
Aaws-region
Bus-west-2
Cmy-region
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid or placeholder string for the region.
Leaving the region blank.
2fill in blank
medium

Complete the code to define a second AWS provider with an alias.

Terraform
provider "aws" {
  region = "us-east-1"
  alias  = "[1]"
}
Drag options to blanks, or click blank then click option'
Awest
Bdefault
Ceast
Dprimary
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' as an alias, which is reserved for the default provider.
Using an alias that does not describe the provider region.
3fill in blank
hard

Fix the error in the resource block to use the aliased provider.

Terraform
resource "aws_s3_bucket" "example" {
  bucket = "my-bucket"
  provider = aws.[1]
}
Drag options to blanks, or click blank then click option'
Adefault
Bprimary
Cwest
Deast
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' or other incorrect aliases that do not exist.
Omitting the provider attribute when multiple providers exist.
4fill in blank
hard

Fill both blanks to configure two AWS providers with different regions and aliases.

Terraform
provider "aws" {
  region = "[1]"
  alias  = "[2]"
}
Drag options to blanks, or click blank then click option'
Aus-west-1
Bus-east-2
Cwest
Deast
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing region and alias values incorrectly.
Using invalid region codes.
5fill in blank
hard

Fill all three blanks to create a resource using the aliased provider and specify the bucket name.

Terraform
resource "aws_s3_bucket" "example" {
  bucket   = "[1]"
  acl      = "private"
  provider = aws.[2]
  tags = {
    Environment = "[3]"
  }
}
Drag options to blanks, or click blank then click option'
Amy-app-bucket
Beast
Cproduction
Dwest
Attempts:
3 left
💡 Hint
Common Mistakes
Using a provider alias that is not defined.
Using an invalid bucket name.
Omitting the environment tag.