# ned1313/implementing-terraform-on-microsoft-azure architecture

> Architecture diagram of the GitHub repository ned1313/implementing-terraform-on-microsoft-azure, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ned1313/implementing-terraform-on-microsoft-azure
- Repository: https://github.com/ned1313/implementing-terraform-on-microsoft-azure

## Overview

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`](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/1-main-vnet) (Main VNet), [`5-remote-state`](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/5-remote-state) (Remote State), [`6-azuredevops`](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/6-azuredevops) (Pipelines), [`7-azure-devops-workspaces`](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/7-azure-devops-workspaces) (Workspaces)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundation["Foundation"]
  node_main_vnet["Main VNet<br/>network module"]
  node_sec_vnet["Sec VNet<br/>network module"]
  node_vnet_peering["Peering<br/>connectivity"]
end

subgraph group_state["State"]
  node_state_prep["State Prep<br/>state setup"]
  node_remote_state[("Remote State<br/>backend config")]
end

subgraph group_automation["Automation"]
  node_azure_devops["Pipelines<br/>ci/cd"]
  node_ws_stack["Workspaces<br/>env stack"]
end

subgraph group_delivery["Delivery"]
  node_app_state["App State<br/>state consumer"]
  node_app_deploy["App Deploy<br/>application stack"]
  node_arm_template["ARM Hybrid<br/>hybrid deploy"]
end

subgraph group_support["Support"]
  node_vm_bootstrap["Terraform VM<br/>bootstrap host"]
end

node_main_vnet -->|"network input"| node_vnet_peering
node_sec_vnet -->|"network input"| node_vnet_peering
node_main_vnet -.->|"foundation"| node_state_prep
node_state_prep -->|"backend"| node_remote_state
node_remote_state -.->|"state ref"| node_azure_devops
node_azure_devops -->|"orchestrates"| node_ws_stack
node_remote_state -->|"outputs"| node_app_state
node_app_state -->|"inputs"| node_app_deploy
node_ws_stack -.->|"env flow"| node_app_deploy
node_main_vnet -->|"subnet base"| node_arm_template
node_arm_template -.->|"hybrid stage"| node_app_deploy
node_vm_bootstrap -.->|"support"| node_azure_devops
node_vm_bootstrap -.->|"tooling"| node_ws_stack

click node_main_vnet "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/1-main-vnet"
click node_sec_vnet "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/2-sec-vnet"
click node_vnet_peering "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/3-vnet-peering"
click node_state_prep "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/4-remote-state-prep"
click node_remote_state "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/5-remote-state"
click node_azure_devops "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/6-azuredevops"
click node_ws_stack "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/7-azure-devops-workspaces"
click node_app_state "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/8-app-remote-state"
click node_app_deploy "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/9-app-deploy"
click node_arm_template "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/10-arm-template"
click node_vm_bootstrap "https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/zz-terraform-vm"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_vnet,node_sec_vnet,node_vnet_peering toneBlue
class node_state_prep,node_remote_state toneAmber
class node_azure_devops,node_ws_stack toneMint
class node_app_state,node_app_deploy,node_arm_template toneRose
class node_vm_bootstrap toneIndigo
```

## Components

### Foundation

Core network and connectivity exercises

- [Main VNet](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/1-main-vnet): network module · Primary Azure virtual network and subnets · `1-main-vnet`
- [Sec VNet](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/2-sec-vnet): network module · Secondary VNet representing a separate boundary · `2-sec-vnet`
- [Peering](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/3-vnet-peering): connectivity · Links the two VNets into one topology · `3-vnet-peering`

### State

Remote state and environment boundaries

- [State Prep](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/4-remote-state-prep): state setup · Prepares Azure storage and prerequisites for remote state · `4-remote-state-prep`
- [Remote State](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/5-remote-state): backend config · Configures Terraform to use external shared state · `5-remote-state`

### Automation

CI/CD and workspace-driven execution

- [Pipelines](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/6-azuredevops): ci/cd · Azure DevOps pipeline definitions for Terraform runs · `6-azuredevops`
- [Workspaces](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/7-azure-devops-workspaces): env stack · Terraform stack driven by Azure DevOps workspaces · `7-azure-devops-workspaces`

### Delivery

Application and hybrid deployment layers

- [App State](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/8-app-remote-state): state consumer · Reads shared outputs from remote state for app provisioning · `8-app-remote-state`
- [App Deploy](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/9-app-deploy): application stack · Deploys the application workload using Terraform · `9-app-deploy`
- [ARM Hybrid](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/10-arm-template): hybrid deploy · Terraform plus ARM template deployment pattern · `10-arm-template`

### Support

Bootstrap infrastructure for the course

- [Terraform VM](https://github.com/ned1313/implementing-terraform-on-microsoft-azure/tree/main/zz-terraform-vm): bootstrap host · Helper VM environment for running Terraform in the course · `zz-terraform-vm`

## Connections

- 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
