Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

infra-setup

Terraform infrastructure for the one-access platform. One Makefile surface, three provider backends: GCP (GKE + GAR), AWS (EKS + ECR), Local (Minikube + Docker registry).


Where it fits

 ┌────────────────┐           ┌────────────────┐           ┌────────────────────┐
 │  infra-setup   │──cluster─▶│   infra-ops    │──deploys─▶│    app layer       │
 │  (Terraform)   │  registry │  (Helm / K8s)  │           │  one-auth / *-ui   │
 │ ◀── you are    │    DNS    │                │           │                    │
 │     here       │           │                │           │                    │
 └────────────────┘           └────────────────┘           └────────────────────┘

Produces the cluster, registry, DNS zone, and Workload Identity Federation that every downstream repo assumes.


What it does

  • Stands up a Kubernetes cluster + container registry + DNS on GCP, AWS, or local Minikube.
  • Wires GitHub Actions to the cloud via Workload Identity Federation — no long-lived cloud keys.
  • Exposes one Makefile (setup, setup-post, integrate-domain, verify, destroy) that delegates to the selected provider.

Architecture

infra-setup/
├── Makefile              # dispatches to <provider>/Makefile
├── gcp/                  # google_container_cluster (Autopilot), GAR, DNS, WIF, LB
│   ├── main.tf           # cluster + artifact registry + billing budget
│   ├── dns.tf            # managed zone + root/www/wildcard records
│   ├── identity-federation.tf  # GitHub WIF pool + service account
│   ├── load-balancer.tf  # global compute address for ingress
│   └── outputs.tf        # values consumed by infra-ops + CI
├── aws/                  # EKS, ECR, VPC, ALB-SG, Route53, OIDC IdP
│   ├── main.tf           # cluster + node group + ECR
│   ├── networking.tf     # VPC, subnets, IGW, routes
│   ├── iam.tf            # EKS cluster + node roles
│   ├── identity-federation.tf  # GitHub OIDC + IAM role
│   ├── route53.tf        # zone
│   └── load-balancer.tf  # ALB security group
├── local/                # Minikube + docker registry (no terraform state)
│   └── Makefile          # minikube start / registry / hosts / tunnel
├── environments/
│   ├── dev.tfvars
│   └── prod.tfvars       # cloud_provider, project_id, domain, WIF pool IDs
└── TERRAFORM-GUIDE.md    # deep dive on state, modules, cost

State is isolated per provider (terraform-gcp.tfstate, terraform-aws.tfstate). Local has no terraform state — it's pure Makefile over Minikube.


What each provider creates

Resource GCP AWS Local
Cluster GKE Autopilot EKS (2× t3.medium) Minikube (4 CPU / 8 GB)
Container registry Artifact Registry ECR Docker registry on :5000
DNS Cloud DNS zone + records Route53 zone /etc/hosts entries
Load balancer / ingress IP Global compute address ALB security group minikube tunnel
GitHub → cloud identity WIF pool + provider + SA OIDC IdP + IAM role n/a
Networking (managed by Autopilot) VPC + subnets + IGW + routes (Minikube network)
Cost guard Billing budget alert — —

Core concepts

  • Provider-delegated Makefile. Root Makefile does no terraform directly; it dispatches make <target> PROVIDER=<p> into <p>/Makefile. Adding a fourth provider is a new directory, not a refactor of the root surface.
  • Workload Identity Federation replaces cloud keys. GitHub Actions authenticates to GCP/AWS via short-lived OIDC tokens exchanged through the federation. No GCP_SA_KEY or AWS_ACCESS_KEY_ID secrets in GitHub.
  • Versioned WIF pool IDs. GCP soft-deletes WIF pools for ~30 days. prod.tfvars pins workload_identity_pool_id = "github-actions-v3" — bump the suffix to re-create cleanly.
  • Env-scoped tfvars, not workspaces. dev.tfvars / prod.tfvars carry the provider-agnostic configuration (project, domain, budget). ENV=dev|prod selects the file; state stays flat.
  • Domain is optional, late-binding. domain_name can be empty at setup time; make integrate-domain PROVIDER=<p> wires DNS later without re-provisioning the cluster.

Run it

# One provider, end to end
make setup        PROVIDER=local                # 1. provision
make setup-post   PROVIDER=local                # 2. kubeconfig + registry login
make verify       PROVIDER=local                # 3. smoke-check

# Cloud (dev env)
make setup        PROVIDER=gcp   ENV=dev
make setup-post   PROVIDER=gcp   ENV=dev
make integrate-domain PROVIDER=gcp ENV=dev      # optional: attach domain later

# Tear down
make destroy      PROVIDER=gcp   ENV=dev

Drop into a provider directory for fine-grained targets: cd gcp && make help.


Configure it

Edit environments/<env>.tfvars:

Variable Purpose
cloud_provider gcp or aws
project_id GCP project / AWS account identifier
region Target region
environment dev / prod
app_name Namespace / resource prefix
domain_name Optional; empty skips DNS
github_organization Org allowed through WIF
workload_identity_pool_id Bump suffix to re-create after GCP soft-delete
billing_account_id GCP-only; required for budget alerts

Links

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages