Terraform Labs
Terraform against Floci (local AWS-shaped cloud, http://localhost:4566) plus a few labs that manage the VPS edge (DNS, records, bootstrap).
The through-line: model infrastructure as code, keep state safe, prove changes in CI, then squeeze cost and risk out of every resource.
Start here: labs/lab-01-toolchain-and-floci-bootstrap/
Want to implement the plugin instead of using it? See the undefined track: 16 labs building a provider in Go with the plugin framework.
Learning path
| Stage | Labs | Outcome |
|---|---|---|
| 1. Language & state | 01–08 | Fluent HCL, safe state, remote backend |
| 2. Reuse & quality | 09–18 | Modules, testing, CI, refactoring, cost tags |
| 3. Cloud building blocks | 19–28 | VPC, compute, storage, IAM, DB, queues, KMS, ALB/ASG |
| 4. FinOps & security | 29–36 | Budgets, spot, lifecycle, Infracost, policy-as-code, hardening |
| 5. Team scale & DR | 37–43 | Multi-env, structure, providers, DR, OpenTofu/Cloud |
| 6. Capstones | 44–45 | Full platform + formal cost/security review |
Lab index
| # | Lab | Level | Primary focus |
|---|---|---|---|
| 01 | Toolchain and Floci bootstrap | Beginner | Providers, endpoints, first apply |
| 02 | HCL language basics | Beginner | Types, expressions, functions |
| 03 | Resources and dependency graph | Beginner | Implicit/explicit deps |
| 04 | Variables and validation | Beginner | Inputs, precedence, guards |
| 05 | Outputs, locals and data sources | Beginner | Interfaces, lookups |
| 06 | State anatomy and surgery | Intermediate | State operations |
| 07 | Remote backend and locking | Intermediate | S3 + DynamoDB on Floci |
| 08 | Workspaces and environments | Intermediate | Env isolation |
| 09 | Modules from scratch | Intermediate | Module design |
| 10 | Registry modules and pinning | Intermediate | Supply chain |
| 11 | Meta-arguments and lifecycle | Intermediate | count/for_each/lifecycle |
| 12 | Provisioners and cloud-init | Intermediate | Bootstrapping, limits |
| 13 | Expressions, functions, dynamic blocks | Intermediate | Advanced HCL |
| 14 | Preconditions and terraform test | Intermediate | Contract + unit tests |
| 15 | CI pipeline for Terraform | Intermediate | fmt/validate/scan/plan |
| 16 | Import, moved and brownfield | Advanced | Adopt existing infra |
| 17 | Drift detection | Advanced | Detect & reconcile |
| 18 | Tags and cost allocation | Intermediate | FinOps foundation |
| 19 | Floci VPC and networking | Intermediate | Network design |
| 20 | Floci compute and user-data | Intermediate | Instances, bootstrap |
| 21 | Floci object storage | Intermediate | S3 security & lifecycle |
| 22 | Floci IAM least privilege | Advanced | Identity security |
| 23 | Floci DynamoDB | Intermediate | NoSQL capacity & cost |
| 24 | Floci SQS/SNS | Intermediate | Decoupling, DLQ |
| 25 | Floci Lambda | Advanced | Serverless IaC |
| 26 | Floci KMS and secrets | Advanced | Encryption, rotation |
| 27 | Load balancing and autoscaling | Advanced | Elastic compute |
| 28 | Multi-AZ and failure domains | Advanced | Resilience vs cost |
| 29 | Billing guardrails and budgets | Advanced | Spend control |
| 30 | Compute rightsizing and spot | Advanced | Unit-cost reduction |
| 31 | Storage lifecycle and cost | Advanced | Storage FinOps |
| 32 | Infracost cost gates | Advanced | Cost in CI |
| 33 | Policy-as-code security scans | Advanced | tfsec/Checkov/OPA |
| 34 | Secure state and secret flow | Advanced | State threat model |
| 35 | Network security hardening | Advanced | SG/NACL/endpoints |
| 36 | IAM hardening and audit | Advanced | Credential hygiene |
| 37 | Multi-environment promotion | Advanced | dev→staging→prod |
| 38 | Terraform at scale structure | Expert | Blast radius, Terragrunt |
| 39 | Provider mastery and upgrades | Expert | Aliases, versions, multi-region |
| 40 | Disaster recovery and state restore | Expert | RTO/RPO drills |
| 41 | OpenTofu and migration | Expert | Portability |
| 42 | Terraform Cloud or Spacelift | Advanced | Managed runs, policy |
| 43 | DNS and edge for your VPS | Intermediate | Real DNS as code |
| 44 | Capstone: platform on Floci | Expert | Full platform |
| 45 | Capstone: cost & security review | Expert | Formal review board |
Non-negotiable habits
- One state per environment; never share a state between unrelated stacks.
terraform planis read before it is approved — read the diff, not just the summary.- Pin providers and modules; commit
.terraform.lock.hcl. - Tag everything:
owner,lab,env,expires_at,cost_center. - Never commit state,
.tfvarswith secrets, or plan files containing secrets. - Destroy lab infrastructure when the lab is done.
Directory convention for your own work
~/iac-work/terraform/
├── modules/
│ └── <name>/{main.tf,variables.tf,outputs.tf,versions.tf,README.md}
├── stacks/
│ └── lab19-network/{main.tf,providers.tf,backend.tf,terraform.tfvars}
└── tests/
Do not put your implementation inside this curriculum folder.
- 01Lab 01 — Toolchain and Floci Bootstrap
- 02Lab 02 — HCL Language Basics
- 03Lab 03 — Resources and the Dependency Graph
- 04Lab 04 — Variables and Validation
- 05Lab 05 — Outputs, Locals, and Data Sources
- 06Lab 06 — State Anatomy and Surgery
- 07Lab 07 — Remote Backend and Locking
- 08Lab 08 — Workspaces and Environments
- 09Lab 09 — Modules from Scratch
- 10Lab 10 — Registry Modules and Pinning
- 11Lab 11 — Meta-arguments and Lifecycle
- 12Lab 12 — Provisioners and Cloud-init
- 13Lab 13 — Expressions, Functions and Dynamic Blocks
- 14Lab 14 — Preconditions and Testing
- 15Lab 15 — CI Pipeline for Terraform
- 16Lab 16 — Import, `moved` and Brownfield
- 17Lab 17 — Drift Detection
- 18Lab 18 — Tags and Cost Allocation
- 19Lab 19 — VPC and Network Foundations
- 20Lab 20 — Compute Instances and User Data
- 21Lab 21 — Object Storage, Security and Lifecycle
- 22Lab 22 — IAM Least Privilege and Trust
- 23Lab 23 — DynamoDB Design and Capacity Economics
- 24Lab 24 — SQS, SNS and Asynchronous Decoupling
- 25Lab 25 — Lambda, Packaging and Event Sources
- 26Lab 26 — KMS, Secrets and Encryption Boundaries
- 27Lab 27 — Load Balancing and Autoscaling
- 28Lab 28 — Multi-AZ Failure Domains and Quorum
- 29Lab 29 — Billing Guardrails, Budgets and Spend Control
- 30Lab 30 — Compute Rightsizing, Credits and Spot
- 31Lab 31 — Storage Lifecycle and Cost
- 32Lab 32 — Infracost Cost Gates
- 33Lab 33 — Policy-as-Code Security Scans
- 34Lab 34 — Secure State and Secret Flow
- 35Lab 35 — Network Security Hardening
- 36Lab 36 — IAM Hardening and Audit
- 37Lab 37 — Multi-Environment Promotion
- 38Lab 38 — Terraform at Scale Structure
- 39Lab 39 — Provider Mastery and Upgrades
- 40Lab 40 — Disaster Recovery and State Restore
- 41Lab 41 — OpenTofu and Migration
- 42Lab 42 — Terraform Cloud or Spacelift
- 43Lab 43 — DNS and Edge for Your VPS
- 44Lab 44 — Capstone: Platform on Floci
- 45Lab 45 — Capstone: Cost and Security Review