# blastik/opella-devops-challenge architecture

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

- Interactive diagram: https://gitdiagram.com/blastik/opella-devops-challenge
- Repository: https://github.com/blastik/opella-devops-challenge

## Overview

##### Project type and purpose
- This is an Infrastructure-as-Code (IaC) DevOps project whose goal is to provision and manage Azure infrastructure using Terraform.
- Key deliverables:
- A reusable Terraform module to deploy an Azure Virtual Network (VNET)
- Environment-specific Terraform configurations (e.g., dev, prod) that consume that module
- A GitHub Actions pipeline to plan and apply changes

##### (expected) file structure
Although the provided file tree only contains README.md, the README implies a structure like:
├─ modules/
│   └─ vnet/               ← reusable VNET module (main.tf, variables.tf, outputs.tf, tests/)
├─ envs/
│   ├─ dev/                ← dev.tf, provider.tf, backend.tf, variables.tf
│   └─ prod/               ← prod.tf, provider.tf, backend.tf, variables.tf
└─ .github/workflows/
└─ ci.yml              ← Terraform plan & apply pipeline

##### Extract architecture insights from the README
- Reusable, parameterized module for VNET deployment
- Multiple environments handled via separate folders or workspaces
- GitHub pipeline orchestrating Terraform lifecycle
- Use of Azure resource groups, virtual machines, blob storage, etc.

##### Main components
a. Developer & GitHub repository
b. CI/CD platform: GitHub Actions workflows
c. Terraform code:
- modules/vnet (reusable)
- envs/{dev,prod} (environment configs)
- Terraform state backend (e.g., Azure Storage Account)
d. Azure infrastructure:
- Resource Groups (dev-rg, prod-rg)
- Virtual Network + subnets (from vnet module)
- Virtual Machines (in dev/prod)
- Blob Storage or other chosen resources
e. External services as needed (e.g., Azure Active Directory for authentication)

##### Relationships and data flows
- Developer pushes code → GitHub repo
- GitHub Actions trigger → runs Terraform init/plan/apply
- Terraform module is invoked by env configs → provisions resources into Azure
- Terraform state is stored in remote backend (Azure Storage)
- Outputs (e.g., subnet IDs, VM public IPs) are displayed in pipeline logs

##### Architectural patterns and design principles
- Modular design: separate reusable module(s) from environment-specific code
- Environment isolation: separate state files and resource groups per environment
- CI/CD as code: pipeline defined alongside Terraform code
- Security & maintainability: parameterization of sensitive values, tagging, automated testing (if any)

##### Relevant technologies and frameworks
- Terraform core (HCL)
- GitHub Actions (YAML pipelines)
- Azure Provider for Terraform
- Azure Resource Manager (ARM) resources
- (Optional) Terraform testing tools (e.g., terratest)

##### Detail
- Every major Terraform file grouping (modules, envs, backends)
- Remote state backend and locking mechanism
- Optional test harness if implemented
- Tagging/labeling strategy in notes or callouts

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer & Version Control Layer
    subgraph "Developer & Version Control"
        Dev["Developer"]:::external
        Repo["GitHub Repo"]:::external
        README["README.md"]:::documentation
    end
    Dev -->|"push code"| Repo
    Repo -->|"contains docs"| README

    %% CI/CD Pipeline Layer
    subgraph "CI/CD Pipeline"
        CI["GitHub Actions (ci.yml)"]:::cicd
        Init["terraform init"]:::terraform
        PlanApply["terraform plan/apply"]:::terraform
    end
    Repo -->|"trigger workflow"| CI
    CI -->|"runs init"| Init
    CI -->|"runs plan/apply"| PlanApply

    %% Terraform Modules & Configs Layer
    subgraph "Terraform Modules & Configs"
        Module["modules/vnet"]:::terraform
        EnvDev["envs/dev"]:::terraform
        EnvProd["envs/prod"]:::terraform
        BackendConfig["Azure Storage Backend"]:::state
    end
    Init -->|"initializes backend"| BackendConfig
    PlanApply -->|"uses env configs"| EnvDev
    PlanApply -->|"uses env configs"| EnvProd
    EnvDev -->|"calls module"| Module
    EnvProd -->|"calls module"| Module

    %% Azure Infrastructure Layer
    subgraph "Azure Infrastructure"
        RGDev["Resource Group (dev-rg)"]:::azure
        RGProd["Resource Group (prod-rg)"]:::azure
        BackendAccount["Storage Account (state)"]:::azure
        SubDev["VNet & Subnets"]:::network
        SubProd["VNet & Subnets"]:::network
        VMDev["Virtual Machines"]:::azure
        VMProd["Virtual Machines"]:::azure
        BlobDev["Blob Storage"]:::azure
        BlobProd["Blob Storage"]:::azure
    end
    BackendConfig -->|"stores state"| BackendAccount
    EnvDev -->|"applies to"| RGDev
    EnvProd -->|"applies to"| RGProd
    RGDev --> SubDev
    RGProd --> SubProd
    SubDev --> VMDev
    SubProd --> VMProd
    RGDev --> BlobDev
    RGProd --> BlobProd

    %% Click Events
    click README "https://github.com/blastik/opella-devops-challenge/blob/master/README.md"

    %% Styles
    classDef terraform fill:#ccffcc,stroke:#2d6a4f;
    classDef cicd fill:#ffe5b4,stroke:#d35400;
    classDef azure fill:#cce5ff,stroke:#1f618d;
    classDef network fill:#e0e0e0,stroke:#7d7d7d;
    classDef state fill:#f5cba7,stroke:#af601a;
    classDef external fill:#f0f0f0,stroke:#888888;
    classDef documentation fill:#d6eaf8,stroke:#2874a6;
```
