A disaster-recovery module creates resources in a primary and a secondary AWS region. The maintainer wants callers to pass two separately configured AWS providers into the module, and wants the module to declare that requirement explicitly. What belongs in the module?
Select an answer to reveal the explanation.
Short Explanation
When your module needs two flavors of the same provider, it should say so in its requirements and let the caller hand them over. That's configuration_aliases, and the caller wires them in with the providers argument.
Full Explanation
A module that needs more than one configuration of the same provider declares the alias names it expects with the configuration_aliases argument inside that provider's entry in required_providers. Resources in the module then select a configuration with the provider meta-argument, for example the primary or secondary alias, and the caller maps its own aliased provider configurations to those names through the providers argument on the module block. The requirement is explicit, documented in the module's interface, and the caller keeps full control of regions and credentials. Declaring aliased provider blocks inside the module reintroduces provider configuration into a shared module, the legacy pattern that blocks count, for_each and depends_on on the module and couples the module to settings the caller should own. Terraform does not support for_each on provider blocks, so a single block cannot be expanded per region. The provider meta-argument takes a static reference to a provider configuration, not an expression, so a variable cannot select the region or configuration at plan time. Exam caveat: the default, unaliased configuration is passed implicitly, but once a module declares aliases the caller must pass them explicitly. Operational check: call the module without the providers argument and confirm Terraform reports the missing aliased configurations, then add the mapping and confirm the plan targets both regions.