nerdexam
HashiCorp

TA-002-P · Question #301

The following is a snippet from a Terraform configuration file: Which, when validated, results in the following error: Fill in the blank in the error message with the correct string from the list belo

The correct answer is D. alias. The validation error references 'alias', which is the required argument when configuring multiple instances of the same provider in Terraform.

Read, generate, and modify configuration

Question

The following is a snippet from a Terraform configuration file:

Which, when validated, results in the following error:

Fill in the blank in the error message with the correct string from the list below.

Options

  • Aversion
  • Bmulti
  • Clabel
  • Dalias

How the community answered

(35 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    6% (2)
  • D
    89% (31)

Why each option

The validation error references 'alias', which is the required argument when configuring multiple instances of the same provider in Terraform.

Aversion

'version' is a provider meta-argument used to pin provider versions and is unrelated to the error produced by a missing or invalid alias in a multi-provider configuration.

Bmulti

'multi' is not a valid Terraform provider configuration argument or a keyword that appears in Terraform validation errors.

Clabel

'label' is not a valid provider configuration argument; the correct term for distinguishing multiple instances of the same provider is alias.

DaliasCorrect

When a Terraform configuration uses multiple instances of the same provider (for example, targeting multiple AWS regions), each additional provider block must include an alias argument to give it a unique identifier. The validation error shown occurs when a resource or module references a provider configuration by alias but the alias value is missing or incorrectly specified in the provider block.

Concept tested: Terraform provider alias for multiple provider configurations

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

Topics

#Provider configuration#Aliases#Terraform errors#Configuration syntax

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice