How chavao/aws-go-pulumi-eks works
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.