In cloud environments, especially in Azure, infrastructure is often spread across multiple subscriptions for security and organizational reasons.
Hub and Spoke Topology is a classic pattern where:
-
- The Hub VNet (shared resources, security services, DNS zones etc.) lives in its own subscription.
- The Spoke VNets (application workloads) live in different subscriptions, each managing their own state files.
While everything works smoothly for independent deployments, the real problem starts when you need cross-subscription interactions, like:
-
- ✅ VNet Peering between Hub and Spoke (both sides need peering objects)
- ✅ Private Endpoint + Private DNS Zones (Private Endpoint in spoke, DNS zone in hub)
By default, Terraform executes operations only against a single provider configuration (in our case, a single Azure subscription).
So, how can we create resources in two different subscriptions at the same time from within the spoke configuration?
Answer → Terraform alias provider.
Continue reading “Terraform alias — Solving Multi-Subscription Deployment Challenges”