azurerm). Provider aliases let you define multiple instances of the same provider within a single Terraform configuration. This is essential when you need to manage resources across multiple Azure regions, subscriptions, or isolated environments from the same codebase.
Why use provider aliases? Typical scenarios include:
- Multi-region deployment: Deploy resources to multiple Azure regions from the same Terraform configuration without duplicating code or maintaining separate projects. Use different provider aliases to target specific regions.
- Multi-subscription / credential management: Run a single Terraform plan against multiple subscriptions or with different credentials (service principals, managed identities) — useful for hub-and-spoke and cross-subscription architectures.
- Environment isolation: Keep production, staging, and sandbox resources separated to reduce the risk of accidental deployment into the wrong environment.

azurerm provider instances and resources bound to them
provider = azurerm.weu and provider = azurerm.qc. Without these, Terraform uses the default (non-aliased) azurerm provider block, which could result in resources being deployed to the wrong subscription or region.
Authentication reminder: setting subscription_id selects the target subscription, but Terraform still needs authentication credentials. Provide credentials via environment variables, a service principal, managed identity, or other supported authentication mechanisms.
Always bind resources explicitly to an aliased provider when working with multiple provider configurations. Explicit bindings prevent accidental deployments to the default provider or the wrong subscription.
When using modules that need to operate against multiple providers, pass the aliased provider into the module explicitly. Example:
If resources are not bound to the correct provider alias, Terraform may create resources in the wrong subscription or region. Always verify provider bindings (and authentication) before running
terraform apply.- Terraform Providers — Multiple Provider Configurations
- AzureRM Provider Documentation
- Azure authentication options for Terraform