Terraform study
Offline — showing the cached copy.
Home / Terraform Labs

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

StageLabsOutcome
1. Language & state01–08Fluent HCL, safe state, remote backend
2. Reuse & quality09–18Modules, testing, CI, refactoring, cost tags
3. Cloud building blocks19–28VPC, compute, storage, IAM, DB, queues, KMS, ALB/ASG
4. FinOps & security29–36Budgets, spot, lifecycle, Infracost, policy-as-code, hardening
5. Team scale & DR37–43Multi-env, structure, providers, DR, OpenTofu/Cloud
6. Capstones44–45Full platform + formal cost/security review

Lab index

#LabLevelPrimary focus
01Toolchain and Floci bootstrapBeginnerProviders, endpoints, first apply
02HCL language basicsBeginnerTypes, expressions, functions
03Resources and dependency graphBeginnerImplicit/explicit deps
04Variables and validationBeginnerInputs, precedence, guards
05Outputs, locals and data sourcesBeginnerInterfaces, lookups
06State anatomy and surgeryIntermediateState operations
07Remote backend and lockingIntermediateS3 + DynamoDB on Floci
08Workspaces and environmentsIntermediateEnv isolation
09Modules from scratchIntermediateModule design
10Registry modules and pinningIntermediateSupply chain
11Meta-arguments and lifecycleIntermediatecount/for_each/lifecycle
12Provisioners and cloud-initIntermediateBootstrapping, limits
13Expressions, functions, dynamic blocksIntermediateAdvanced HCL
14Preconditions and terraform testIntermediateContract + unit tests
15CI pipeline for TerraformIntermediatefmt/validate/scan/plan
16Import, moved and brownfieldAdvancedAdopt existing infra
17Drift detectionAdvancedDetect & reconcile
18Tags and cost allocationIntermediateFinOps foundation
19Floci VPC and networkingIntermediateNetwork design
20Floci compute and user-dataIntermediateInstances, bootstrap
21Floci object storageIntermediateS3 security & lifecycle
22Floci IAM least privilegeAdvancedIdentity security
23Floci DynamoDBIntermediateNoSQL capacity & cost
24Floci SQS/SNSIntermediateDecoupling, DLQ
25Floci LambdaAdvancedServerless IaC
26Floci KMS and secretsAdvancedEncryption, rotation
27Load balancing and autoscalingAdvancedElastic compute
28Multi-AZ and failure domainsAdvancedResilience vs cost
29Billing guardrails and budgetsAdvancedSpend control
30Compute rightsizing and spotAdvancedUnit-cost reduction
31Storage lifecycle and costAdvancedStorage FinOps
32Infracost cost gatesAdvancedCost in CI
33Policy-as-code security scansAdvancedtfsec/Checkov/OPA
34Secure state and secret flowAdvancedState threat model
35Network security hardeningAdvancedSG/NACL/endpoints
36IAM hardening and auditAdvancedCredential hygiene
37Multi-environment promotionAdvanceddev→staging→prod
38Terraform at scale structureExpertBlast radius, Terragrunt
39Provider mastery and upgradesExpertAliases, versions, multi-region
40Disaster recovery and state restoreExpertRTO/RPO drills
41OpenTofu and migrationExpertPortability
42Terraform Cloud or SpaceliftAdvancedManaged runs, policy
43DNS and edge for your VPSIntermediateReal DNS as code
44Capstone: platform on FlociExpertFull platform
45Capstone: cost & security reviewExpertFormal review board

Non-negotiable habits

  1. One state per environment; never share a state between unrelated stacks.
  2. terraform plan is read before it is approved — read the diff, not just the summary.
  3. Pin providers and modules; commit .terraform.lock.hcl.
  4. Tag everything: owner, lab, env, expires_at, cost_center.
  5. Never commit state, .tfvars with secrets, or plan files containing secrets.
  6. 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.

  1. 01Lab 01 — Toolchain and Floci Bootstrap
  2. 02Lab 02 — HCL Language Basics
  3. 03Lab 03 — Resources and the Dependency Graph
  4. 04Lab 04 — Variables and Validation
  5. 05Lab 05 — Outputs, Locals, and Data Sources
  6. 06Lab 06 — State Anatomy and Surgery
  7. 07Lab 07 — Remote Backend and Locking
  8. 08Lab 08 — Workspaces and Environments
  9. 09Lab 09 — Modules from Scratch
  10. 10Lab 10 — Registry Modules and Pinning
  11. 11Lab 11 — Meta-arguments and Lifecycle
  12. 12Lab 12 — Provisioners and Cloud-init
  13. 13Lab 13 — Expressions, Functions and Dynamic Blocks
  14. 14Lab 14 — Preconditions and Testing
  15. 15Lab 15 — CI Pipeline for Terraform
  16. 16Lab 16 — Import, `moved` and Brownfield
  17. 17Lab 17 — Drift Detection
  18. 18Lab 18 — Tags and Cost Allocation
  19. 19Lab 19 — VPC and Network Foundations
  20. 20Lab 20 — Compute Instances and User Data
  21. 21Lab 21 — Object Storage, Security and Lifecycle
  22. 22Lab 22 — IAM Least Privilege and Trust
  23. 23Lab 23 — DynamoDB Design and Capacity Economics
  24. 24Lab 24 — SQS, SNS and Asynchronous Decoupling
  25. 25Lab 25 — Lambda, Packaging and Event Sources
  26. 26Lab 26 — KMS, Secrets and Encryption Boundaries
  27. 27Lab 27 — Load Balancing and Autoscaling
  28. 28Lab 28 — Multi-AZ Failure Domains and Quorum
  29. 29Lab 29 — Billing Guardrails, Budgets and Spend Control
  30. 30Lab 30 — Compute Rightsizing, Credits and Spot
  31. 31Lab 31 — Storage Lifecycle and Cost
  32. 32Lab 32 — Infracost Cost Gates
  33. 33Lab 33 — Policy-as-Code Security Scans
  34. 34Lab 34 — Secure State and Secret Flow
  35. 35Lab 35 — Network Security Hardening
  36. 36Lab 36 — IAM Hardening and Audit
  37. 37Lab 37 — Multi-Environment Promotion
  38. 38Lab 38 — Terraform at Scale Structure
  39. 39Lab 39 — Provider Mastery and Upgrades
  40. 40Lab 40 — Disaster Recovery and State Restore
  41. 41Lab 41 — OpenTofu and Migration
  42. 42Lab 42 — Terraform Cloud or Spacelift
  43. 43Lab 43 — DNS and Edge for Your VPS
  44. 44Lab 44 — Capstone: Platform on Floci
  45. 45Lab 45 — Capstone: Cost and Security Review