# jaisonaj77/test-digram architecture

> Architecture diagram of the GitHub repository jaisonaj77/test-digram, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaisonaj77/test-digram
- Repository: https://github.com/jaisonaj77/test-digram

## Overview

1. **What this repo is**
   - This is an **Azure infrastructure-as-code repository** built with **Terraform**.
   - Its purpose is to provision a production-oriented Kubernetes platform in **Central India**, centered on **AKS** and **ACR**, with a modular layout and GitOps-friendly operation.

2. **Top-level structure**
   - The repo is split into:
     - **`bootstrap/`** for initial remote state infrastructure
     - **`modules/`** for reusable Terraform building blocks
     - **`environments/`** for per-environment composition, currently **`dev`**
     - **`pipelines/`** for CI/CD automation via **Azure Pipelines**

3. **Bootstrap boundary**
   - `bootstrap/backend/main.tf` exists to create the Terraform backend foundation, likely an **Azure Storage Account / blob container** setup for remote state.
   - This is a one-time or early-stage dependency so the rest of the infrastructure can use centralized state management instead of local state files.

4. **Environment composition boundary**
   - `environments/dev/` is the place where the reusable modules are wired together for the development environment.
   - `main.tf` here is the orchestration layer: it decides which modules are instantiated, what parameters they receive, and how outputs from one module feed into another.

5. **Core reusable modules**
   - `modules/resource-group` encapsulates Azure resource group creation and naming.
   - `modules/vnet` defines the network foundation.
   - `modules/acr` provisions the **Azure Container Registry**.
   - `modules/aks` provisions the **Azure Kubernetes Service** cluster.
   - Each module has its own `main.tf`, `variables.tf`, and `outputs.tf`, which makes the repo strongly componentized.

6. **Network architecture**
   - The network module is important because the README explicitly calls out a **private AKS subnet** and an **optional ingress subnet**.
   - That implies the cluster is deployed into a controlled VNet layout rather than public default networking.
   - In diagram terms, the VNet is a shared dependency under which AKS nodes/pods and any ingress tier are placed.

7. **Compute and container flow**
   - **ACR** is the image registry.
   - **AKS** is the runtime where workloads run.
   - The key data flow is: build container image → push to ACR → AKS pulls image from ACR for deployment.
   - The repo also mentions an **ACR pull role assignment**, which is the authorization link enabling AKS to read images from the registry.

8. **Identity and access boundary**
   - The ACR pull role assignment is a distinct integration point between the registry and the cluster.
   - This indicates the design uses Azure RBAC/managed identity style access rather than manual credentials for image pulls.
   - For a diagram, this is an important security edge between the platform services.

9. **State and deployment flow**
   - Terraform state is intended to live in **Azure Blob storage** created by the bootstrap step.
   - The likely flow is:
     1. Bootstrap backend
     2. Initialize remote state
     3. Apply environment modules
     4. Deploy AKS/ACR/network resources
   - This makes the repo operationally split between state provisioning and workload/platform provisioning.

10. **CI/CD automation**
   - `pipelines/azure-pipeline.yml` suggests **Azure DevOps Pipelines** drives Terraform execution.
   - The pipeline is the delivery mechanism for plan/apply, tying the repo to automated infra changes rather than manual CLI usage.
   - In an architecture diagram, this is the control plane that triggers Terraform against the environment stack.

11. **Environment scope**
   - The presence of `environments/dev` implies the repo is designed to scale to multiple environments by repeating the same module composition with different variables.
   - The current visible environment is development, but the structure is clearly intended for promotion patterns like dev/test/prod.

12. **Main architectural dependencies**
   - The dependency chain is:
     - Bootstrap backend enables Terraform remote state
     - Environment layer consumes modules
     - Resource group anchors all Azure resources
     - VNet provides isolated network space
     - ACR stores images
     - AKS runs workloads
     - Role assignment connects AKS to ACR
   - Those are the main boxes and arrows needed for an accurate diagram.

13. **What stands out architecturally**
   - This is a **platform foundation repo**, not an application repo.
   - The important boundaries are Terraform state, reusable infrastructure modules, environment-specific assembly, and Azure DevOps pipeline execution.
   - The repo is optimized for repeatable Azure platform provisioning with clear separation between shared primitives and environment deployment.

Main entry points: [`environments/dev/main.tf`](https://github.com/jaisonaj77/test-digram/blob/main/environments/dev/main.tf) (Dev stack), [`modules/aks/main.tf`](https://github.com/jaisonaj77/test-digram/blob/main/modules/aks/main.tf) (AKS), [`modules/resource-group/main.tf`](https://github.com/jaisonaj77/test-digram/blob/main/modules/resource-group/main.tf) (Resource group), [`modules/acr/main.tf`](https://github.com/jaisonaj77/test-digram/blob/main/modules/acr/main.tf) (ACR)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_bootstrap["Bootstrap"]
  node_node_backend[("Backend<br/>terraform state foundation<br/>[main.tf]")]
end

subgraph group_grp_env["Environment"]
  node_node_env_dev["Dev stack<br/>environment composition<br/>[main.tf]"]
  node_node_env_backend["Dev backend<br/>state config<br/>[backend.tf]"]
end

subgraph group_grp_modules["Modules"]
  node_node_rg["Resource group<br/>azure rg module<br/>[main.tf]"]
  node_node_vnet["VNet<br/>network module<br/>[main.tf]"]
  node_node_acr[("ACR<br/>registry module<br/>[main.tf]")]
  node_node_aks["AKS<br/>cluster module<br/>[main.tf]"]
  node_node_acr_pull(("ACR pull<br/>rbac link"))
end

subgraph group_grp_ci["Pipelines"]
  node_node_pipeline["Azure pipeline<br/>ci pipeline<br/>[azure-pipeline.yml]"]
end

node_node_pipeline -->|"bootstrap"| node_node_backend
node_node_pipeline -->|"deploy"| node_node_env_dev
node_node_backend -->|"remote state"| node_node_env_backend
node_node_env_backend -->|"init state"| node_node_env_dev
node_node_env_dev -->|"creates"| node_node_rg
node_node_env_dev -->|"creates"| node_node_vnet
node_node_env_dev -->|"creates"| node_node_acr
node_node_env_dev -->|"creates"| node_node_aks
node_node_rg -->|"anchors"| node_node_vnet
node_node_rg -->|"anchors"| node_node_acr
node_node_rg -->|"anchors"| node_node_aks
node_node_vnet -->|"network"| node_node_aks
node_node_acr -->|"images"| node_node_aks
node_node_acr_pull -->|"authorizes"| node_node_acr
node_node_acr_pull -->|"enables pull"| node_node_aks

click node_node_backend "https://github.com/jaisonaj77/test-digram/blob/main/bootstrap/backend/main.tf"
click node_node_env_dev "https://github.com/jaisonaj77/test-digram/blob/main/environments/dev/main.tf"
click node_node_env_backend "https://github.com/jaisonaj77/test-digram/blob/main/environments/dev/backend.tf"
click node_node_rg "https://github.com/jaisonaj77/test-digram/blob/main/modules/resource-group/main.tf"
click node_node_vnet "https://github.com/jaisonaj77/test-digram/blob/main/modules/vnet/main.tf"
click node_node_acr "https://github.com/jaisonaj77/test-digram/blob/main/modules/acr/main.tf"
click node_node_aks "https://github.com/jaisonaj77/test-digram/blob/main/modules/aks/main.tf"
click node_node_pipeline "https://github.com/jaisonaj77/test-digram/blob/main/pipelines/azure-pipeline.yml"

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_node_backend toneBlue
class node_node_env_dev,node_node_env_backend toneAmber
class node_node_rg,node_node_vnet,node_node_acr,node_node_aks,node_node_acr_pull toneMint
class node_node_pipeline toneRose
```

## Components

### Bootstrap

One-time backend foundation for remote Terraform state

- [Backend](https://github.com/jaisonaj77/test-digram/blob/main/bootstrap/backend/main.tf): terraform state foundation · Creates the remote state backend infrastructure in Azure · `bootstrap/backend/main.tf`

### Environment

Per-environment Terraform composition

- [Dev stack](https://github.com/jaisonaj77/test-digram/blob/main/environments/dev/main.tf): environment composition · Wires reusable modules together for the dev environment · `environments/dev/main.tf`
- [Dev backend](https://github.com/jaisonaj77/test-digram/blob/main/environments/dev/backend.tf): state config · Configures the environment to use remote Terraform state · `environments/dev/backend.tf`

### Modules

Reusable Azure infrastructure building blocks

- [Resource group](https://github.com/jaisonaj77/test-digram/blob/main/modules/resource-group/main.tf): azure rg module · Creates and names the Azure resource group anchor · `modules/resource-group/main.tf`
- [VNet](https://github.com/jaisonaj77/test-digram/blob/main/modules/vnet/main.tf): network module · Defines the shared virtual network and subnet layout · `modules/vnet/main.tf`
- [ACR](https://github.com/jaisonaj77/test-digram/blob/main/modules/acr/main.tf): registry module · Provisions the Azure Container Registry for images · `modules/acr/main.tf`
- [AKS](https://github.com/jaisonaj77/test-digram/blob/main/modules/aks/main.tf): cluster module · Provisions the Kubernetes control plane and worker cluster · `modules/aks/main.tf`
- **ACR pull**: rbac link · Grants the cluster permission to pull images from ACR

### Pipelines

Azure DevOps automation for Terraform execution

- [Azure pipeline](https://github.com/jaisonaj77/test-digram/blob/main/pipelines/azure-pipeline.yml): ci pipeline · Automates Terraform plan and apply through Azure DevOps · `pipelines/azure-pipeline.yml`

## Connections

- Azure pipeline → Backend: bootstrap · Runs the backend foundation step
- Azure pipeline → Dev stack: deploy · Drives Terraform execution for the dev environment
- Backend → Dev backend: remote state · Provides the storage foundation consumed by environment backend config
- Dev backend → Dev stack: init state · Environment stack uses remote state before applying modules
- Dev stack → Resource group: creates · Environment composition instantiates the resource group module
- Dev stack → VNet: creates · Environment composition instantiates the network module
- Dev stack → ACR: creates · Environment composition instantiates the registry module
- Dev stack → AKS: creates · Environment composition instantiates the cluster module
- Resource group → VNet: anchors · Resource group scopes the network resources
- Resource group → ACR: anchors · Resource group scopes the registry resources
- Resource group → AKS: anchors · Resource group scopes the cluster resources
- VNet → AKS: network · AKS is deployed into the virtual network and subnets
- ACR → AKS: images · AKS consumes container images from the registry
- ACR pull → ACR: authorizes · RBAC link grants registry read access
- ACR pull → AKS: enables pull · Lets the cluster pull private images without manual credentials
