# shayshahak-zz/terraform-on-azure-using-a-golden-image architecture

> Architecture diagram of the GitHub repository shayshahak-zz/terraform-on-azure-using-a-golden-image, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shayshahak-zz/terraform-on-azure-using-a-golden-image
- Repository: https://github.com/shayshahak-zz/terraform-on-azure-using-a-golden-image

## Overview

##### Project type and purpose
- This is an Infrastructure-as-Code (IaC) project written in Terraform (HCL) that targets Microsoft Azure.
- Its sole purpose is to deploy three Virtual Machines from a pre-configured Azure Managed Image (the “golden image”).

##### File structure
- main.tf: Defines Azure provider settings and resource definitions (resource group, network, NICs, VMs, etc.).
- variables.tf: Declares input variables (e.g., resource group name, image ID, VM size, location).
- There are no subdirectories or modules—this is a flat, single-module Terraform configuration.

##### README for additional insights
- Confirms that these files are based on the official AzureRM provider example (vm-from-managed-image).
- Implies use of Terraform CLI, the AzureRM provider plug-in, and possibly a remote or local state backend.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Terraform Layer
    subgraph "Terraform Configuration" 
        direction TB
        README["README.md"]:::terraform
        VAR["variables.tf"]:::terraform
        MAIN["main.tf"]:::terraform
        STATE["State Backend\n(local or remote)"]:::terraform
        README -->|reads| TFCLI
        VAR -->|loads variables| TFCLI
        MAIN -->|loads config| TFCLI
        TFCLI["Terraform CLI"]:::terraform
        TFCLI -->|initializes & plans| STATE
    end

    %% Azure Control Plane
    TFCLI -->|"terraform apply"| ARM["Azure Resource Manager API"]:::api

    %% Azure Resources
    subgraph "Azure Resource Group" 
        direction TB
        RG["Resource Group"]:::azureres

        subgraph "Networking" 
            direction TB
            VNET["Virtual Network"]:::azureres
            SUBNET["Subnet"]:::azureres
            VNET --> SUBNET
            SUBNET --> NIC1["NIC for VM1"]:::azureres
            SUBNET --> NIC2["NIC for VM2"]:::azureres
            SUBNET --> NIC3["NIC for VM3"]:::azureres
            NIC1 --> PIP1["Public IP VM1"]:::azureres
            NIC2 --> PIP2["Public IP VM2"]:::azureres
            NIC3 --> PIP3["Public IP VM3"]:::azureres
        end

        ARM --> RG
        RG --> VNET
        ARM --> IMAGE["Managed Image"]:::azureres
        IMAGE --> VM1["VM Instance 1"]:::azureres
        IMAGE --> VM2["VM Instance 2"]:::azureres
        IMAGE --> VM3["VM Instance 3"]:::azureres
        NIC1 --> VM1
        NIC2 --> VM2
        NIC3 --> VM3

        %% State update from resources
        VM1 -->|state update| STATE
        VM2 -->|state update| STATE
        VM3 -->|state update| STATE
        VNET -->|state update| STATE
        SUBNET -->|state update| STATE
        NIC1 -->|state update| STATE
        NIC2 -->|state update| STATE
        NIC3 -->|state update| STATE
        PIP1 -->|state update| STATE
        PIP2 -->|state update| STATE
        PIP3 -->|state update| STATE
        IMAGE -->|state update| STATE
        RG -->|state update| STATE
    end

    %% Click Events
    click MAIN "https://github.com/shayshahak-zz/terraform-on-azure-using-a-golden-image/blob/master/main.tf"
    click VAR "https://github.com/shayshahak-zz/terraform-on-azure-using-a-golden-image/blob/master/variables.tf"
    click README "https://github.com/shayshahak-zz/terraform-on-azure-using-a-golden-image/blob/master/README.md"

    %% Styles
    classDef terraform fill:#CCE5FF,stroke:#3399FF,color:#000;
    classDef api fill:#FFD699,stroke:#FF9900,color:#000;
    classDef azureres fill:#DFF0D8,stroke:#3C763D,color:#000;
```
