# mayur-1999/workflow-test architecture

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

- Interactive diagram: https://gitdiagram.com/mayur-1999/workflow-test
- Repository: https://github.com/mayur-1999/workflow-test

## Overview

After analyzing the file tree and README, we can see that this project is a Terraform-based infrastructure-as-code repository designed to deploy and manage cloud infrastructure components. The repository is structured around reusable Terraform modules that define various parts of the infrastructure, including virtual machines, VPC network resources, dashboards, GKE alerts, Spanner alerts, notification channels, and Prometheus alerts. Additionally, there are several GitHub Actions workflows under the .github directory that automate build, deploy, pull-request validations, and a self-hosted runner workflow. An Excel sheet with important links is also included, possibly to document external resources or additional project details.

##### Main Components of the System
- Terraform Root Configuration: This includes files like main.tf, provider.tf, and variables.tf which set up the overall configuration, define providers, and inject variables.
- Terraform Modules: Each module encapsulates a distinct piece of infrastructure:
- VPC Module: Contains configuration for networking.
- VM Module: Deals with virtual machines and their associated properties such as CPU, disk, firewall, and uptime checks.
- Dashboards Module: Includes portfolio definitions (e.g., GKE cluster and pod dashboards, Spanner dashboard) for monitoring.
- GKE Module: Configures Google Kubernetes Engine alerts.
- Notification Channel Module: Defines channels for alert notifications.
- Prometheus-Alert Module: Sets up Prometheus-related alerts such as HTTP latency.
- Spanner Module: Configures alerts specific to Spanner.
- CI/CD Pipelines: Represented by the various GitHub Actions workflows defined in .github/workflows – these automate testing, building, deploying, and PR checks.

##### Relationships and Interactions
- The Root Configuration calls the various Terraform modules, implying a dependency chain where proper initialization and execution of provider configurations and variable definitions affect all modules.
- The VPC module likely serves as the foundational networking layer that the VM and possibly GKE module require.
- Dashboards and alert modules (GKE, Prometheus, Spanner) interact with the respective infrastructure components they monitor, and the Notification Channel module aggregates alerts via external services.
- Workflows (CI/CD pipelines) orchestrate the Terraform deployments and ensure that any infrastructure changes go through automated checks before being applied.

##### Architectural Patterns and Design Principles
- Modularity: The use of individual modules reflects a decomposed architecture where each module is responsible for one aspect of the infrastructure.
- Reusability and Extensibility: The segregation of responsibilities allows for easy updates and expansion (adding more modules or extending configurations for new cloud services).
- Infrastructure as Code (IaC): Consistent use of Terraform to declaratively manage cloud resources.
- CI/CD Integration: Using GitHub Actions for continuous testing and deployment, ensuring that infrastructure changes are tested before application.

##### Relevant Technologies, Frameworks, and Libraries
- Terraform: Core technology for provisioning the infrastructure.
- GitHub Actions: Used for automation of builds, tests, and deployments.
- Cloud Platforms (implied by modules like GKE and Spanner): Likely Google Cloud, given the names and context.
- Possibly Prometheus for metrics and alerting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Terraform Root Configuration
    ROOT["Root Terraform Config"]:::module

    %% Terraform Modules Subgraph
    subgraph "Terraform Modules"
        VPC["VPC Module"]:::module
        VM["VM Module"]:::module
        DASH["Dashboards Module"]:::module
        GKE["GKE Alerts Module"]:::module
        PROM["Prometheus-Alert Module"]:::module
        SPAN["Spanner Alerts Module"]:::module
        NC["Notification Channel Module"]:::module
    end

    %% CI/CD Pipelines
    CICD["GitHub Actions Workflows"]:::cicd

    %% External Resources
    EXT["Documentation/Resource Links"]:::external

    %% Relationships
    CICD -->|"triggers"| ROOT

    ROOT -->|"calls"| VPC
    ROOT -->|"calls"| VM
    ROOT -->|"calls"| DASH
    ROOT -->|"calls"| GKE
    ROOT -->|"calls"| PROM
    ROOT -->|"calls"| SPAN
    ROOT -->|"calls"| NC

    VPC -->|"supports"| VM
    VPC -->|"supports"| GKE

    GKE -->|"alertsTo"| NC
    PROM -->|"alertsTo"| NC
    SPAN -->|"alertsTo"| NC

    %% Click Events
    click ROOT "https://github.com/mayur-1999/workflow-test/blob/main/main.tf"
    click VPC "https://github.com/mayur-1999/workflow-test/tree/main/modules/vpc"
    click VM "https://github.com/mayur-1999/workflow-test/tree/main/modules/VM"
    click DASH "https://github.com/mayur-1999/workflow-test/tree/main/modules/dashboards"
    click GKE "https://github.com/mayur-1999/workflow-test/tree/main/modules/gke"
    click PROM "https://github.com/mayur-1999/workflow-test/tree/main/modules/prometheus-alert"
    click SPAN "https://github.com/mayur-1999/workflow-test/tree/main/modules/spanner"
    click NC "https://github.com/mayur-1999/workflow-test/tree/main/modules/notification-channel"
    click CICD "https://github.com/mayur-1999/workflow-test/tree/main/.github/workflows"
    click EXT "https://github.com/mayur-1999/workflow-test/blob/main/Links.xlsx"

    %% Styles
    classDef module fill:#ACE1AF,stroke:#333,stroke-width:2px;
    classDef cicd fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef external fill:#89C4F4,stroke:#000,stroke-width:2px;
```
