One configuration must create a primary bucket in us-east-1 and a replica bucket in us-west-2 using the AWS provider. How should the providers be configured?
Select an answer to reveal the explanation.
Short Explanation
Provider aliases are like having two phone lines into the same company: same provider, different extension. You name the second line west and tell the replica to call that one. The trap is thinking Terraform will guess which block you meant based on where it sits in the file.
Full Explanation
A provider can have multiple configurations in one module. The default configuration has no alias; each additional configuration needs a unique alias argument along with its own settings, such as region. Resources use the default configuration unless their provider meta-argument names another one, written as PROVIDER.ALIAS, so provider = aws.west places the replica in us-west-2 while the primary keeps using the default in us-east-1. Two provider blocks for the same provider without an alias conflict, because only one default configuration may exist; Terraform does not use file position to choose between blocks. required_providers declares which provider source and version a module needs under a local name; adding a second local name for the same source does not create a region-specific configuration, and region is a provider configuration argument, not a requirement setting. depends_on accepts only resource and module references and cannot set environment variables, and environment variables apply to the whole process rather than to one resource. Exam caveat: when the replica lives in a child module, the aliased configuration must be passed through the module block's providers argument. Operational check: run terraform plan and confirm the replica's planned region attribute shows us-west-2.