TERRAFORM-ASSOCIATE-004 · Question #259
A provider alias is used for what purpose in a Terraform configuration file?
The correct answer is D. using the same provider with different configurations for different resources. A provider alias in Terraform allows you to configure the same provider multiple times with different settings for various resources within a single configuration.
Question
Options
- Aalias isn't used with providers, they are used with provisioners
- Bto signify what cloud-based region to deploy resources
- Cto use as shorthand for resources to be deployed with the referenced provider
- Dusing the same provider with different configurations for different resources
How the community answered
(41 responses)- A2% (1)
- B2% (1)
- C5% (2)
- D90% (37)
Why each option
A provider alias in Terraform allows you to configure the same provider multiple times with different settings for various resources within a single configuration.
Aliases are a fundamental feature of provider configuration in Terraform, allowing multiple instances of the same provider to coexist with different settings, not just provisioners.
While an alias can distinguish providers by region, its purpose is to enable multiple configurations of the same provider, not solely to signify a region.
Provider aliases do not act as shorthand for resources; instead, they explicitly define different configurations for the same provider, which resources then reference to specify which configuration to use.
Provider aliases allow a single provider (e.g., AWS) to be configured multiple times within the same Terraform configuration, each with a distinct set of parameters (e.g., different regions or credentials), enabling resources to be deployed with these varied settings.
Concept tested: Terraform provider aliases purpose
Source: https://developer.hashicorp.com/terraform/language/providers/configuration#alias-configurations
Topics
Community Discussion
No community discussion yet for this question.