# alfonsora6/ejemplo-infraestructura-terraform architecture

> Architecture diagram of the GitHub repository alfonsora6/ejemplo-infraestructura-terraform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alfonsora6/ejemplo-infraestructura-terraform
- Repository: https://github.com/alfonsora6/ejemplo-infraestructura-terraform

## Overview

##### Project type and purpose
- This is an “Infrastructure as Code” project: it uses Terraform templates to provision Azure resources and YAML-based CI/CD pipelines to plan, apply, and destroy that infrastructure.
- The goal is to spin up a single Azure VM running a simple “Hola mundo” web server via automated pipelines.

##### File structure
- Top-level files:
- README.md – high-level description of purpose (“implementación de infraestructura Azure…”).
- terraform-*.yaml – three pipeline definitions (plan, apply, destroy).
- Templates folder:
- Templates/main.tf – Terraform resource definitions (Resource Group, VNet, Subnet, NIC, Public IP, NSG, Virtual Machine, Web server startup).
- Templates/variables.tf – input variables for resource names, locations, VM size, etc.

##### README for additional insights
- Confirms Azure as target cloud, use of VM to host web server, and pipelines driven by YAML definitions.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors
    Dev["Developer"]:::user

    %% Source Control
    subgraph "Source Control"
        Repo["Git Repository"]:::repo
    end

    %% CI/CD Pipelines
    subgraph "CI/CD Pipelines"
        Plan["Plan Pipeline"]:::ci
        Apply["Apply Pipeline"]:::ci
        Destroy["Destroy Pipeline"]:::ci
    end

    %% Terraform Engine
    subgraph "Terraform"
        TF["Terraform Engine"]:::tf
        Main["main.tf"]:::tfmodule
        Var["variables.tf"]:::tfmodule
    end

    %% Azure Cloud Resources
    subgraph "Azure Cloud"
        AZ["Azure Subscription"]:::cloud
        RG["Resource Group"]:::cloud
        subgraph "Networking"
            VNet["Virtual Network"]:::cloud
            Subnet["Subnet"]:::cloud
            NIC["Network Interface"]:::cloud
            PublicIP["Public IP"]:::cloud
            NSG["Network Security Group"]:::cloud
        end
        VM["Virtual Machine\n(Web Server)"]:::vm
    end

    %% External Client
    Client["External Client\n(Browser)"]:::client

    %% Connections
    Dev -->|"git push"| Repo
    Repo -->|"triggers"| Plan
    Repo -->|"triggers"| Apply
    Repo -->|"triggers"| Destroy
    Plan -->|"runs Terraform"| TF
    Apply -->|"runs Terraform"| TF
    Destroy -->|"runs Terraform destroy"| TF
    TF -->|"reads"| Main
    TF -->|"reads"| Var
    TF -->|"Azure REST API"| AZ
    AZ --> RG
    RG --> VNet
    VNet --> Subnet
    Subnet --> NIC
    NIC --> PublicIP
    NIC --> NSG
    NIC --> VM
    PublicIP --> VM
    NSG --> VM
    Client -->|"HTTP GET port 80"| PublicIP

    %% Click Events
    click Repo "https://github.com/alfonsora6/ejemplo-infraestructura-terraform/blob/main/README.md"
    click Plan "https://github.com/alfonsora6/ejemplo-infraestructura-terraform/blob/main/terraform-plan.yaml"
    click Apply "https://github.com/alfonsora6/ejemplo-infraestructura-terraform/blob/main/terraform-apply.yaml"
    click Destroy "https://github.com/alfonsora6/ejemplo-infraestructura-terraform/blob/main/terraform-destroy.yaml"
    click Main "https://github.com/alfonsora6/ejemplo-infraestructura-terraform/blob/main/Templates/main.tf"
    click Var "https://github.com/alfonsora6/ejemplo-infraestructura-terraform/blob/main/Templates/variables.tf"

    %% Styles
    classDef repo fill:#D6E9FE,stroke:#2B7FFF,color:#000
    classDef ci fill:#D0EBFF,stroke:#1C7ED6,color:#000
    classDef tf fill:#D3F9D8,stroke:#37B24D,color:#000
    classDef tfmodule fill:#E6FCF5,stroke:#69DB7C,color:#000
    classDef cloud fill:#FFF3BF,stroke:#F08C00,color:#000
    classDef vm fill:#FFD8A8,stroke:#FA8C16,color:#000
    classDef client fill:#F8F9FA,stroke:#D0D5DD,color:#000
    classDef user fill:#CED4DA,stroke:#495057,color:#000
```
