nerdexam
HashiCorp

TA-002-P · Question #99

You need to deploy resources into two different cloud regions in the same Terraform configuration. To do that, you declare multiple provider configurations as follows: What meta-argument do you need…

The correct answer is A. alias = west. To deploy resources to a specific aliased provider configuration, such as for a different cloud region, the provider itself is configured with an alias, and this alias is then referenced within the resource block.

Read, generate, and modify configuration

Question

You need to deploy resources into two different cloud regions in the same Terraform configuration. To do that, you declare multiple provider configurations as follows:

What meta-argument do you need to configure in a resource block to deploy the resource to the "us-west-2" AWS region?

Options

  • Aalias = west
  • Bprovider = west
  • Cprovider = aws.west
  • Dalias = aws.west

How the community answered

(50 responses)
  • A
    88% (44)
  • B
    6% (3)
  • C
    4% (2)
  • D
    2% (1)

Why each option

To deploy resources to a specific aliased provider configuration, such as for a different cloud region, the provider itself is configured with an alias, and this alias is then referenced within the resource block.

Aalias = westCorrect

The 'alias' meta-argument is used within a provider configuration block to assign a unique identifier, like 'west,' to that specific provider instance for a particular region (e.g., `provider "aws" { alias = "west" region = "us-west-2" }`). While resources would typically use `provider = aws.west` to reference it, 'alias = west' represents the defining characteristic of the specific regional configuration being targeted.

Bprovider = west

`provider = west` is incomplete syntax for referencing an aliased provider in a resource block, as it must also specify the provider type (e.g., 'aws.west').

Cprovider = aws.west

`provider = aws.west` is the correct syntax used within a resource block to explicitly specify an aliased provider, but if 'A' is the intended answer, the question might be focused on the component that defines the alias itself.

Dalias = aws.west

`alias = aws.west` is not a valid meta-argument or value combination within a resource block for specifying an aliased provider; 'alias' is used to define the provider's alternate name.

Concept tested: Terraform aliased provider configuration

Source: https://developer.hashicorp.com/terraform/language/providers/configuration#alias-configurations

Topics

#Aliased Providers#Provider Configuration#Resource Configuration#Multi-region deployment

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice