TA-002-P · Question #335
When using multiple configurations of the same Terraform provider, what meta-argument must be included in any non-default provider configurations?
The correct answer is B. alias. When you need to configure the same Terraform provider multiple times with different settings within a single configuration, you must use the alias meta-argument to differentiate the non-default instances. This allows Terraform to correctly identify and use the specific…
Question
When using multiple configurations of the same Terraform provider, what meta-argument must be included in any non-default provider configurations?
Options
- Aname
- Balias
- Cdepends_on
- Did
How the community answered
(47 responses)- A2% (1)
- B87% (41)
- C2% (1)
- D9% (4)
Why each option
When you need to configure the same Terraform provider multiple times with different settings within a single configuration, you must use the `alias` meta-argument to differentiate the non-default instances. This allows Terraform to correctly identify and use the specific provider configuration for different resources or modules.
`name` is not a standard meta-argument used to differentiate provider configurations; provider types are implicitly named by their type (e.g., `aws`, `azurerm`).
The `alias` meta-argument is essential for distinguishing between multiple configurations of the same provider type within a single Terraform configuration. Each non-default provider block must have a unique alias, allowing resources or modules to explicitly specify which provider configuration to use.
`depends_on` is used to manage explicit dependencies between resources or modules, not to differentiate multiple provider configurations.
`id` is typically an attribute of a specific resource instance, not a meta-argument for provider configuration blocks.
Concept tested: Terraform provider aliases
Source: https://developer.hashicorp.com/terraform/language/providers/configuration#multiple-provider-configurations
Topics
Community Discussion
No community discussion yet for this question.