# chavao/aws-go-pulumi-eks architecture

> Architecture diagram of the GitHub repository chavao/aws-go-pulumi-eks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chavao/aws-go-pulumi-eks
- Repository: https://github.com/chavao/aws-go-pulumi-eks

## Overview

##### Project Type and Purpose
- This is an “Infrastructure as Code” project using Pulumi (Go) to provision an AWS environment.
- Its primary goal is to create a VPC (networking) and an EKS cluster (compute) in AWS.

##### File Structure
- main.go
– Entry point: initializes the Pulumi program and loads configuration.
- infra/networking/vpc.go
– Defines your VPC, subnets, route tables, and any networking rules.
- infra/compute/eks.go
– Defines the EKS cluster, node groups, IAM roles, and related compute resources.
- Pulumi.yaml
– Stack configuration and metadata.
- go.mod / go.sum
– Dependencies for Pulumi SDK and AWS Go SDK modules.

##### README
- Lists prerequisites: Pulumi, AWS credentials, Go.
- Shows CLI commands (`pulumi preview`, `pulumi up`, `pulumi destroy`).

##### Main Components
A. Developer/Operator CLI
– The developer runs `pulumi up` from their workstation.
B. Pulumi Engine
– Parses Go code, computes resource changes, and issues AWS API calls.
C. AWS Control Plane
– The AWS API endpoint that receives calls from Pulumi.
D. Networking Module (VPC)
– VPC, public/private subnets, route tables, IGW, NAT Gateways.
E. Compute Module (EKS)
– EKS control plane, node groups (managed or self-managed), IAM roles, security groups.
F. Pulumi State
– (Optional) Backend where Pulumi stores stack state (e.g., Pulumi Service or S3).

##### Relationships and Data Flows
1. Developer → CLI: runs `pulumi preview/up`.
2. CLI → Pulumi Engine: loads Pulumi.yaml, Go modules, and infra code.
3. Pulumi Engine → AWS Control Plane:
a. Create/Update VPC resources as defined in infra/networking/vpc.go.
b. Create/Update EKS resources as defined in infra/compute/eks.go.
4. AWS Control Plane → AWS Services: provisions VPC components, then EKS cluster & nodes.
5. Pulumi Engine ↔ Pulumi State: reads/writes current resource state.

##### Architectural Patterns and Principles
- Modularization: separation into “networking” and “compute” modules.
- Declarative IaC: desired state defined in Go code, Pulumi ensures convergence.
- Single-responsibility: each file handles a distinct resource group.

##### Essential Elements to Capture
- Clear labels for all components (CLI, Engine, AWS API, State backend, VPC, EKS).
- Notes on important technologies: Go, Pulumi SDK v3, AWS Go SDK v6, EKS, VPC.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer and CLI
    Developer["Developer/Operator"]:::developer
    CLI["Pulumi CLI"]:::cli
    Developer -->|"runs pulumi up/preview"| CLI

    %% Project Code Modules
    subgraph "Project Code" 
        Config["Pulumi.yaml"]:::code
        Networking["VPC Module (vpc.go)"]:::networking
        Compute["EKS Module (eks.go)"]:::compute
        Deps["Dependencies (go.mod, go.sum)"]:::code
        Docs["README.md"]:::code
    end
    CLI -->|"loads code"| Config
    CLI -->|"loads code"| Networking
    CLI -->|"loads code"| Compute
    CLI -->|"loads code"| Deps
    CLI -->|"reference"| Docs

    %% Pulumi Engine and State
    Engine["Pulumi Engine"]:::engine
    CLI -->|"executes program"| Engine
    State["Pulumi State"]:::state
    Engine -->|"read/write state"| State

    %% AWS Interaction
    API["AWS API Endpoint"]:::aws
    Engine -->|"apply changes"| API

    subgraph "AWS Resources" 
        subgraph "Networking (VPC)" 
            VPC["VPC, Subnets, IGW, NAT"]:::networking
        end
        subgraph "Compute (EKS)" 
            EKS["EKS Control Plane & Nodes"]:::compute
        end
    end
    API -->|"provision vpc"| VPC
    API -->|"provision eks"| EKS

    %% Click Events
    click CLI "https://github.com/chavao/aws-go-pulumi-eks/blob/main/main.go"
    click Engine "https://github.com/chavao/aws-go-pulumi-eks/blob/main/main.go"
    click Config "https://github.com/chavao/aws-go-pulumi-eks/blob/main/Pulumi.yaml"
    click Networking "https://github.com/chavao/aws-go-pulumi-eks/blob/main/infra/networking/vpc.go"
    click Compute "https://github.com/chavao/aws-go-pulumi-eks/blob/main/infra/compute/eks.go"
    click Deps "https://github.com/chavao/aws-go-pulumi-eks/blob/main/go.mod"
    click Docs "https://github.com/chavao/aws-go-pulumi-eks/blob/main/README.md"

    %% Styles
    classDef developer fill:#cccccc,stroke:#333,stroke-width:1px
    classDef cli fill:#ffcc00,stroke:#333,stroke-width:1px
    classDef engine fill:#dd00dd,stroke:#333,stroke-width:1px
    classDef state fill:#00cccc,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef aws fill:#ff6666,stroke:#333,stroke-width:1px
    classDef networking fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef compute fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef code fill:#ffeeaa,stroke:#333,stroke-width:1px
```
