Reusable Terraform module for Azure Virtual Network + multi-environment deployment.
- Reusable Module:
modules/vnet/(VNet + subnets + optional NSG) - Environments:
- Dev →
eastus - Prod →
westus(Microsoft paired region)
- Dev →
- Resources per environment:
- Resource Group (with consistent tags)
- Virtual Network + Subnets + NSG (via reusable module)
- Windows Virtual Machine
- Storage Account (Blob) + Private Endpoint
- Naming: Microsoft Cloud Adoption Framework (CAF) standards
- Tagging: Applied at Resource Group level (
Environment,ManagedBy,Project,Region)
The following tools are automatically enforced in the CI pipeline:
terraform fmt— code formatting validationtflint— linting and best practicestrivy— security and misconfiguration scanningterraform-docs— auto-generated module documentation
-
Separate CI and CD pipelines (industry best practice)
terraform-ci.yml→ Runs on every push:- Quality checks (
fmt,tflint,trivy,terraform-docs) - Terraform Plan for both environments
- Auto-generates and commits
terraform-plan-dev.txtandterraform-plan-prod.txt
- Quality checks (
terraform-cd.yml→ Manual deployment:- Apply to Dev
- Apply to Prod (with manual approval gate)
-
Both pipelines use Azure OIDC for secure authentication (no secrets stored in GitHub).
- terraform-plan-dev.txt (auto-updated by CI)
- terraform-plan-prod.txt (auto-updated by CI)
- CI Pipeline:
.github/workflows/terraform-ci.yml - CD Pipeline:
.github/workflows/terraform-cd.yml
See modules/vnet/README.md (auto-generated with terraform-docs).