How sathish-katakam/azure-cloudplatform works
1. This repository is an Azure platform automation workspace centered on Terraform Cloud. Its job is to split a shared management configuration into per-LOB Terraform Cloud workspaces, then let those workspaces provision Azure infrastructure.
2. The main source of truth is locals.tf. It contains the nested configuration for environments (npe, prd) and each line of business. The automation reads that file, extracts the requested LOB, and turns it into workspace-specific inputs.
3. The orchestration path starts in .github/workflows/split-workspace.yml. A human triggers it with an environment and LOB name. The workflow normalizes inputs, runs the Python asset-preparation step, commits generated files, and then invokes the workspace-management script.
4. plz-automation-scripts/mgmt-split-workspace-trigger/main.py is the control-plane entrypoint. It verifies the management workspace exists, selects only the requested LOB, and coordinates Terraform Cloud workspace creation/update and run triggering. It does not deploy Azure resources itself; it manages the Terraform Cloud boundary.
5. plz-automation-scripts/modules/terraform_apis.py is the integration layer to Terraform Cloud. It performs workspace lookup, run triggering, and run monitoring, which makes Terraform Cloud the execution engine for the actual infrastructure changes.
6. plz-automation-scripts/mgmt-split-workspace-trigger/prepare_lob_assets.py is the data-shaping step. It generates and refreshes per-environment/per-LOB JSON artifacts under line-of-businesses/, platform-landing-zones/, and systemnodepools/, plus CIDR-related docs. Those generated files are then used to sync workspace variables.
7. The repo is structured around two major Terraform layers: platform and LOB. terraform/platform and terraform/modules/platform define shared foundation capabilities, while terraform/lob and terraform/modules/lob define the per-LOB workload stack. The README makes the intended boundary explicit: platform owns shared foundation; LOB consumes it.
8. The LOB Terraform path is the repeated operational path. The LOB workspace runs from terraform/lob, which calls terraform/modules/lob. That module creates Azure workload infrastructure such as resource groups, Log Analytics workspaces, VNets, subnets, NSGs, and AKS-related networking.
9. The platform path is a bootstrap/shared-services path. It is created less often and is meant to establish environment-level foundations such as shared networking, governance, identity, and Terraform Cloud workspace structure. LOB workspaces then consume the platform outputs rather than rebuilding the same foundation.
10. The repo also contains other Terraform roots that look like separate operational domains: terraform/landing-zone, terraform/app-foundation, terraform/aks, terraform/addons, and terraform/lob, each with matching reusable modules in terraform/modules/. This suggests a layered platform model rather than a single monolithic Terraform stack.
11. The generated JSON directories under line-of-businesses/, platform-landing-zones/, and systemnodepools/ are important integration artifacts. They act as the bridge between the shared config and the per-workspace Terraform variables that Terraform Cloud consumes during plan/apply.
12. The key external boundary is Terraform Cloud, which then talks to Azure through the Terraform Azure provider. The README notes that real Azure deployment depends on Terraform Cloud environment variables such as ARM_CLIENT_ID, ARM_CLIENT_SECRET, ARM_SUBSCRIPTION_ID, and ARM_TENANT_ID, so Azure authentication is part of the deployment boundary, not the repository itself.
13. Architecturally, the data flow is: engineer updates locals.tf → GitHub Actions runs split-workspace automation → JSON assets and workspace variables are generated/synced → Terraform Cloud workspace is created/updated → Terraform executes Azure infrastructure changes. That is the core loop to draw in an architecture diagram.
14. A useful diagram boundary is to separate “control plane” from “infrastructure plane.” The control plane is GitHub Actions plus the Python/Terraform Cloud API automation; the infrastructure plane is the Terraform Cloud-managed Terraform roots/modules that provision Azure resources for platform and LOBs.
Main entry points: main.py Workspace trigger · prepare_lob_assets.py Prepare assets · split-workspace.yml Split workflow · terraform_apis.py TFC APIs
Components 23
Control plane
Human-triggered automation that splits shared config and manages Terraform Cloud workspaces.
- locals.tf · Shared management configuration and the source of truth for environments and line-of-business definitions.
locals.tf - Split workflow · Manual orchestration entrypoint that normalizes inputs, prepares assets, commits generated files, and triggers workspace management.
.github/workflows/split-workspace.yml - Prepare assets · Extracts the requested LOB from shared config and refreshes per-environment JSON artifacts and CIDR-related docs.
plz-automation-scripts/mgmt-split-workspace-trigger/prepare_lob_assets.py - Workspace trigger · Verifies the management workspace, selects the requested LOB, and coordinates Terraform Cloud workspace creation, update, and run triggering.
plz-automation-scripts/mgmt-split-workspace-trigger/main.py - TFC APIs · Workspace lookup, variable sync, run triggering, and run monitoring against Terraform Cloud.
plz-automation-scripts/modules/terraform_apis.py - Platform ws · Platform workspace shaping and variable wiring used by the management automation.
plz-automation-scripts/modules/platform/workspaces.py - LOB ws · LOB workspace shaping and variable wiring used by the management automation.
plz-automation-scripts/modules/lob/workspaces.py
Infrastructure plane
Terraform roots and reusable modules that Terraform Cloud uses to provision Azure.
- Platform root · Shared foundation stack for environment-level networking, governance, identity, and workspace structure.
terraform/platform - Platform module · Reusable implementation for the shared platform foundation.
terraform/modules/platform - Landing zone · Separate operational domain for landing-zone provisioning.
terraform/landing-zone - Landing module · Reusable implementation for landing-zone resources.
terraform/modules/landing-zone - App foundation · Application foundation layer for environment-specific workload prerequisites.
terraform/app-foundation - App module · Reusable implementation for app-foundation resources.
terraform/modules/app-foundation - LOB root · Per-LOB operational path that consumes platform outputs and provisions workload infrastructure.
terraform/lob - LOB module · Creates workload infrastructure such as resource groups, Log Analytics, VNets, subnets, NSGs, and AKS networking.
terraform/modules/lob - AKS root · Dedicated AKS stack for cluster-related provisioning.
terraform/aks - AKS module · Reusable implementation for AKS resources.
terraform/modules/aks - Addons root · Operational domain for add-on provisioning.
terraform/addons - Addons module · Reusable implementation for add-on resources.
terraform/modules/addons - Azure · Target cloud where Terraform Cloud executes infrastructure changes using Azure credentials.
Generated artifacts
Per-environment and per-LOB JSON inputs produced from shared configuration.
- LOB JSON · Per-environment and per-LOB artifacts under line-of-businesses/ that feed workspace variables.
line-of-businesses - PLZ JSON · Per-environment platform-landing-zones artifacts used to sync platform workspace variables.
platform-landing-zones - Nodepool JSON · Per-environment systemnodepools artifacts used by the split-workspace automation.
systemnodepools
Connections 28
- locals.tf → Split workflow: shared config · Workflow starts from the shared management configuration.
- Split workflow → Prepare assets: prepare · Triggered workflow runs the asset-preparation step.
- Prepare assets → LOB JSON: write · Generates per-LOB JSON artifacts.
- Prepare assets → PLZ JSON: write · Generates platform landing-zone JSON artifacts.
- Prepare assets → Nodepool JSON: write · Generates system nodepool JSON artifacts.
- Split workflow → Workspace trigger: invoke · Workflow hands off to the workspace-management entrypoint.
- Workspace trigger → TFC APIs: manage · Entrypoint uses Terraform Cloud APIs to look up workspaces, sync variables, and trigger runs.
- TFC APIs → Platform ws: platform · API layer supports platform workspace management.
- TFC APIs → LOB ws: lob · API layer supports LOB workspace management.
- Platform ws → PLZ JSON: sync vars · Platform workspace inputs are derived from generated platform artifacts.
- LOB ws → LOB JSON: sync vars · LOB workspace inputs are derived from generated LOB artifacts.
- LOB ws → Nodepool JSON: sync vars · LOB workflow also consumes nodepool artifacts when needed.
- Workspace trigger → Platform root: create/update · Management automation coordinates platform workspace lifecycle.
- Workspace trigger → LOB root: create/update · Management automation coordinates LOB workspace lifecycle.
- Platform root → Platform module: uses · Platform root delegates implementation to the reusable module.
- Landing zone → Landing module: uses · Landing-zone root delegates implementation to the reusable module.
- App foundation → App module: uses · App foundation root delegates implementation to the reusable module.
- LOB root → LOB module: uses · LOB root delegates implementation to the reusable module.
- AKS root → AKS module: uses · AKS root delegates implementation to the reusable module.
- Addons root → Addons module: uses · Addons root delegates implementation to the reusable module.
- Platform module → Azure: provisions · Shared platform foundation is applied in Azure.
- Landing module → Azure: provisions · Landing-zone resources are applied in Azure.
- App module → Azure: provisions · App foundation resources are applied in Azure.
- LOB module → Azure: provisions · LOB workload infrastructure is applied in Azure.
- AKS module → Azure: provisions · AKS resources are applied in Azure.
- Addons module → Azure: provisions · Add-on resources are applied in Azure.
- Workspace trigger → Platform root: platform boundary · Platform is the shared foundation boundary consumed by downstream workspaces.
- Workspace trigger → LOB root: lob boundary · LOB is the repeated operational boundary that provisions workload infrastructure.