Infrastructure as Code for a sample web stack, provisioned with Terraform across three targets and continuously validated by GitHub Actions. The stack itself is a Rust backend and a componentized React frontend served by the same IaC.
| Target | Provider | What is provisioned |
|---|---|---|
| Docker | kreuzwerker/docker |
Local containers (PostgreSQL, Redis, backend, frontend) |
| Kubernetes | hashicorp/kubernetes |
Namespace, deployment, service, ingress on a local kind cluster |
| AWS | hashicorp/aws |
VPC, ECS Fargate service, RDS PostgreSQL |
| Directory | Stack | Role |
|---|---|---|
backend/ |
Rust + axum + sqlx | HTTP API with PostgreSQL persistence |
frontend/ |
React 18 + Vite + TypeScript | Componentized UI, neutral white theme |
The app is a complete monolith: PostgreSQL-backed CRUD (/api/environments) plus an infrastructure
overview, served by the Rust backend and rendered by the React frontend.
infra-as-code/
├── backend/ Rust backend (axum)
├── frontend/ React + Vite componentized frontend
├── terraform/ Terraform root + modules + environments
│ ├── main.tf Wiring of the three modules
│ ├── modules/
│ │ ├── docker/ docker provider
│ │ ├── kubernetes/ kubernetes provider
│ │ └── aws/ aws provider
│ └── environments/ dev.tfvars, production.tfvars
├── kubernetes/ Raw manifests, applied by the module
├── docker-compose.yml Local app stack (builds backend + frontend)
├── scripts/ setup.sh, teardown.sh
├── Makefile make init / plan / apply / docker / k8s / aws / build
└── .github/workflows/ terraform-validate, terraform-plan, terraform-apply
- Terraform >= 1.9
- Colima + Docker CLI (local targets)
- kind (kubernetes target)
- AWS credentials (the
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGIONenvironment variables or an SSO profile) for the AWS target - A GitHub token with
workflowscope (Actions), see.github/workflows/
make setup # start colima, create the kind cluster
make build # docker build backend and frontend images
make init # terraform init
make plan # terraform plan -var-file=environments/dev.tfvars
make apply # terraform apply -var-file=environments/dev.tfvars
make docker # build images and apply only the docker module
make k8s # apply only the kubernetes module
make aws # apply only the aws module
make destroy # tear everything downRun the app stack without Terraform:
docker compose up --build # postgres :5433, backend :8080, frontend :5173Or on the host (hot reload):
docker compose up -d postgres # database only
DATABASE_URL=postgres://app:local@localhost:5433/app cargo run -C backend # backend
npm --prefix frontend run dev # frontend on :5173See docs/architecture.md for the full picture.