# abitvolatile/tf-live-devops-toolchain architecture

> Architecture diagram of the GitHub repository abitvolatile/tf-live-devops-toolchain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abitvolatile/tf-live-devops-toolchain
- Repository: https://github.com/abitvolatile/tf-live-devops-toolchain

## Overview

##### Main Components of the System
- Container Build & Execution: Represent the Docker image built using the Dockerfile. Include the docker-entrypoint.sh and functions.sh as integral scripts that bootstrap and run the Terraform commands.
- Terraform Environment: Show the “environment” directory that contains Terraform configuration files (composition.tf and environment.auto.tfvars) along with the .terraform-version file. This is the core module that defines the deployment for Google Cloud resources.
- Google Cloud Platform (GCP) Resources: List out the major resources provisioned (GCE instance groups/VMs, GKE clusters, VPC, networking components, firewall rules, load balancers, etc.) as outlined in the README.
- Auxiliary Tools & Services: Highlight third-party/official artifacts such as Jenkins (via Docker), Spinnaker (via Helm), and Prometheus & its related services (via custom Helm charts).

##### Relationships and Interactions
- External integrations, such as triggering provisioning via the docker-entrypoint.sh and functions.sh scripts, which abstract the terraform execution (including tf_destroy for cleanup).

##### Architectural Patterns and Design Principles
- Infrastructure-as-Code: Clearly denote that Terraform is the primary orchestration engine.
- Immutable Infrastructure & Single Build Image: Highlight that the container image (built with all OS patches, Docker-CE, and required tooling) remains consistent across deployment environments.
- Separation of Concerns: Clearly separate provisioning logic (Terraform configurations) from container execution and external cloud service configurations.

##### Relevant Technologies and Tools
- Containerization: Docker, Dockerfile, docker-entrypoint.sh, functions.sh.
- Configuration Management: Terraform (with its .tfvars and .tf versions) and Packer (for the machine image templates).
- Cloud Resources: Various GCP services (GCE, GKE, networking, IAM etc.) as described in the README.
- Third-Party Tools: Jenkins, Spinnaker, Prometheus ecosystem tools (Prometheus TSDB, AlertManager, Grafana, etc.), and Helm charts.

##### Essential Details
- All Main Components: Docker container (built from Dockerfile), Terraform configuration (in the environment directory), and the various cloud resources.
- Dependencies: Indicate prerequisites like Google Cloud credentials and Terraform Cloud configurations.
- Annotations: Include notes for critical scripts (docker-entrypoint.sh, functions.sh) and their roles in the overall deployment process.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level: Source Control and CI/CD
    SC["GitHub & CI Workflows"]:::ci

    %% Container Build & Execution Subgraph
    subgraph "Container Build & Execution"
        DFile["Dockerfile"]:::container
        Entry["docker-entrypoint.sh"]:::container
        Func["functions.sh"]:::container
    end

    %% Container Execution Environment node
    ContainerImage["Container Execution Environment (Docker)"]:::container

    %% Terraform Environment node
    TerraformEnv["Terraform Environment (composition.tf, environment.auto.tfvars, .terraform-version)"]:::terraform

    %% GCP Infrastructure Provisioning node
    GCP["GCP Infrastructure Provisioning (GKE, GCE, VPC, Networking, Firewall, Load Balancers)"]:::gcp

    %% Auxiliary Tools Subgraph
    subgraph "Auxiliary Tools"
        Jenkins["Jenkins (Docker)"]:::tool
        Spinnaker["Spinnaker (Helm)"]:::tool
        Prometheus["Prometheus (Helm)"]:::tool
    end

    %% Relationships and Data Flow
    SC -->|"triggers"| DFile
    DFile -->|"builds"| ContainerImage
    Entry ---|"provides bootstrap"| ContainerImage
    Func ---|"provides helper functions"| ContainerImage
    ContainerImage -->|"executes Terraform commands"| TerraformEnv
    TerraformEnv -->|"provisions"| GCP
    TerraformEnv -->|"deploys CI/CD tools"| Jenkins
    TerraformEnv -->|"deploys CI/CD tools"| Spinnaker
    TerraformEnv -->|"deploys monitoring"| Prometheus

    %% Click Events for Component Mapping
    click DFile "https://github.com/abitvolatile/tf-live-devops-toolchain/tree/master/Dockerfile"
    click Entry "https://github.com/abitvolatile/tf-live-devops-toolchain/blob/master/docker-entrypoint.sh"
    click Func "https://github.com/abitvolatile/tf-live-devops-toolchain/blob/master/functions.sh"
    click TerraformEnv "https://github.com/abitvolatile/tf-live-devops-toolchain/tree/master/environment/"

    %% Class definitions for colors and styles
    classDef ci fill:#f4d03f,stroke:#000,stroke-width:2px;
    classDef container fill:#aed6f1,stroke:#000,stroke-width:2px;
    classDef terraform fill:#d5f5e3,stroke:#000,stroke-width:2px;
    classDef gcp fill:#fadbd8,stroke:#000,stroke-width:2px;
    classDef tool fill:#f9e79f,stroke:#000,stroke-width:2px;
```
