How ned1313/implementing-terraform-on-microsoft-azure works
This repository is a course-style Terraform codebase for building a staged Azure landing zone and application deployment. The folders are ordered progression steps: each directory adds one more infrastructure concern, so the architecture is intentionally modular and cumulative rather than a single monolithic deployment.
1. Core pattern: incremental Terraform modules
• Each numbered folder is a separate exercise boundary.
• Earlier folders create foundational Azure infrastructure; later folders consume outputs/state from those foundations.
• The repo is designed so you can draw a dependency chain from networking, to shared state, to pipeline automation, to application deployment.
2. Primary network foundation: 1-main-vnet
• Builds the first virtual network and its subnets in Azure.
• This is the base network layer for the scenario and likely provides the main address space for later resources.
• This module is the anchor for many later dependencies.
3. Secondary network boundary: 2-sec-vnet
• Creates a second VNet, representing a separate security or admin network domain.
• The course notes mention two subscriptions/providers in the broader scenario, so this folder helps demonstrate multi-provider / multi-scope Terraform patterns.
• It exists as a distinct boundary from the main network, not as an extension of it.
4. Network-to-network connectivity: 3-vnet-peering
• Establishes peering between the VNets created earlier.
• This is the first explicit cross-module integration point: resources from separate network stacks are connected rather than managed independently.
• Architecturally, this turns isolated VNets into a connected topology for shared services and access paths.
5. Remote state foundation: 4-remote-state-prep and 5-remote-state
• These folders introduce Terraform remote state as shared infrastructure metadata.
• 4-remote-state-prep appears to prepare the storage and prerequisites needed to store state remotely.
• 5-remote-state contains the backend configuration, making Terraform state external and reusable across later modules.
• This is a key boundary: later stacks should not hardcode networking values; they should read them from remote state.
6. ARM template integration: 10-arm-template
• Demonstrates Terraform working alongside an Azure ARM template.
• The presence of azuredeploy.json plus Terraform files indicates a hybrid deployment pattern where Terraform orchestrates or complements native Azure template resources.
• subnet_delegation.tf suggests this module focuses on subnet policy/delegation details needed by the template-driven resource.
7. Azure DevOps delivery layer: 6-azuredevops
• Contains YAML pipeline definitions for Azure DevOps, including separate UAT and production pipeline configs.
• This folder shifts the architecture from manual Terraform runs to CI/CD-managed Terraform execution.
• The pipelines become the control plane for plan/apply workflows and environment promotion.
8. Terraform workspaces and environment separation: 7-azure-devops-workspaces
• Shows how Azure DevOps pipelines can drive Terraform workspaces.
• The presence of backend.tf, main.tf, and vnet-peering.tf implies multiple environments are separated by workspace/state identity while reusing the same code.
• This introduces an environment boundary without duplicating the entire infrastructure codebase.
9. Application stack consuming shared infrastructure: 8-app-remote-state and 9-app-deploy
• 8-app-remote-state likely reads outputs from previously created remote state so the app layer can attach to the right network or dependencies.
• 9-app-deploy is the actual application deployment stage, with a terraform.tfvars.example showing parameterized deployment inputs.
• Architecturally, this is the transition from platform/network provisioning to workload provisioning.
10. VM bootstrap helper: zz-terraform-vm
• This is a supporting utility stack used because the original Terraform marketplace item was deprecated.
• It deploys a VM environment needed to run Terraform in the course scenario, effectively acting as a bootstrap or admin workstation layer.
• It is auxiliary infrastructure, not part of the final application topology.
11. Shared technology boundaries
• Terraform is the primary orchestration tool across all modules.
• AzureRM is the main cloud provider, with Azure DevOps for pipeline automation and Azure ARM templates for one hybrid step.
• The repository also references Azure Active Directory and Service Principal creation in the course context, which matters because identity is part of the provisioning boundary, not just networking.
12. Overall data flow to capture in a diagram
• Start with foundational Azure networks.
• Add peering to connect isolated network domains.
• Externalize state to a remote backend.
• Use that state as a data source for later stacks.
• Automate Terraform execution through Azure DevOps pipelines and workspaces.
• Deploy application resources only after the shared platform dependencies are in place.
Main entry points: 1-main-vnet Main VNet · 5-remote-state Remote State · 6-azuredevops Pipelines · 7-azure-devops-workspaces Workspaces
Components 11
Foundation
Core network and connectivity exercises
State
Remote state and environment boundaries
- State Prep · Prepares Azure storage and prerequisites for remote state
4-remote-state-prep - Remote State · Configures Terraform to use external shared state
5-remote-state
Automation
CI/CD and workspace-driven execution
- Pipelines · Azure DevOps pipeline definitions for Terraform runs
6-azuredevops - Workspaces · Terraform stack driven by Azure DevOps workspaces
7-azure-devops-workspaces
Delivery
Application and hybrid deployment layers
- App State · Reads shared outputs from remote state for app provisioning
8-app-remote-state - App Deploy · Deploys the application workload using Terraform
9-app-deploy - ARM Hybrid · Terraform plus ARM template deployment pattern
10-arm-template
Support
Bootstrap infrastructure for the course
- Terraform VM · Helper VM environment for running Terraform in the course
zz-terraform-vm
Connections 13
- Main VNet → Peering: network input · Main VNet participates in peering
- Sec VNet → Peering: network input · Secondary VNet participates in peering
- Main VNet → State Prep: foundation · Network foundation supports later shared services
- State Prep → Remote State: backend · Prepared storage becomes the remote state backend
- Remote State → Pipelines: state ref · Pipelines consume externally managed state
- Pipelines → Workspaces: orchestrates · Pipelines drive environment-specific workspace execution
- Remote State → App State: outputs · Application layer reads shared infrastructure outputs
- App State → App Deploy: inputs · Remote outputs parameterize application deployment
- Workspaces → App Deploy: env flow · Workspace pattern carries environment separation into delivery
- Main VNet → ARM Hybrid: subnet base · Template deployment depends on network and subnet context
- ARM Hybrid → App Deploy: hybrid stage · Hybrid template step precedes or complements app rollout
- Terraform VM → Pipelines: support · Bootstrap host supports automated Terraform workflows
- Terraform VM → Workspaces: tooling · Workspace exercises can be run from the helper VM