QuestionQ65

Terraform configuration

You need to deploy resources to two different regions in the same Terraform configuration, using the block shown in the exhibit area on this page.

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

What must you add to the provider configuration to deploy the resource to the us-west-2 AWS Region?

  • A resource “aws_instance” “example-us-west-2” {ami = data.aws_ami.ubuntu.idinstance_type = “t3.micro”}
  • B provider “aws” {region = “us-east-1”}provider “aws” “west” {region = “us-west-2”}
  • C provider “aws_west” {region = “us-west-2”}
  • D provider “aws” {region = “us-east-1”}provider “aws” {alias = “west”region = “us-west-2”}
Explanation

Multiple configurations of the same Terraform provider require each additional configuration to have a unique alias. The unaliased AWS configuration is the default; assigning alias = "west" to the us-west-2 configuration makes it addressable as aws.west, which resources can select using their provider meta-argument.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!