Skip to content
>_higan
This post has a translation:Read in Tiếng Việt

Terraform Mastery: A Practical Learning Path

A structured self-study path for Terraform — theory, hands-on labs, and a real project, from initial setup through production-grade infrastructure.

A structured Terraform learning path that combines theory, hands-on labs, and a real project. Everything here is stuff that comes up in actual work.


What you'll be able to do

After finishing the series, you'll be comfortable with:

  • Writing production-grade Terraform with clean, well-structured modules.
  • Managing state safely — remote backends, locking, state surgery, import.
  • Designing reusable modules with versioning and publishing.
  • Handling multiple environments (dev/staging/prod) the right way.
  • Writing tests for infrastructure — terraform test, tflint, checkov, terratest.
  • Plugging Terraform into a CI/CD pipeline — GitHub Actions, GitLab CI, Atlantis.
  • Dealing with drift and refactoring safely using moved/import/removed blocks.
  • Applying security practices: secrets management, policy-as-code, least privilege.

Learning roadmap

                    ┌─────────────────────────────────────────────┐
   WEEKS 1-2        │  00. Setup  →  01. Fundamentals              │
   (Foundations)    │  02. State  →  03. Variables/Outputs         │
                    └─────────────────────────────────────────────┘
                                        │
                    ┌─────────────────────────────────────────────┐
   WEEKS 3-5        │  04. Expressions/Functions/Data sources      │
   (Intermediate)   │  05. Loops & Conditionals                    │
                    │  06. Modules                                 │
                    └─────────────────────────────────────────────┘
                                        │
                    ┌─────────────────────────────────────────────┐
   WEEKS 6-9        │  07. Multi-env & Workspaces                  │
   (Advanced)       │  08. Testing & CI/CD                         │
                    │  09. Security/Secrets/Drift/Refactoring      │
                    └─────────────────────────────────────────────┘
                                        │
                    ┌─────────────────────────────────────────────┐
   WEEKS 10-12      │  10. Capstone Project (3-tier production)    │
   (Production)     │  Cheat sheet + review                        │
                    └─────────────────────────────────────────────┘

The week numbers are a rough guide, not a hard schedule. Go at whatever pace works for you. The only rule: type out every line of code yourself. Don't copy-paste.


Module index

#ModuleTopicsLevel
00Setup & EnvironmentInstall Terraform, providers, safe practice env (LocalStack)
01FundamentalsHCL, providers, resources, plan/apply, lifecycle
02State ManagementState file, remote backend, locking, import⭐⭐
03Variables & Outputsvariable, output, locals, validation, sensitive⭐⭐
04Expressions & Functionsfunctions, data sources, dependency, dynamic⭐⭐
05Loops & Conditionalscount, for_each, for, dynamic blocks, conditionals⭐⭐⭐
06Modulesmodule design, versioning, registry, composition⭐⭐⭐
07Multi-Environmentworkspaces vs directories, DRY, partial backend⭐⭐⭐
08Testing & CI/CDterraform test, tflint, checkov, GitHub Actions⭐⭐⭐⭐
09Security & Refactoringsecrets, OPA, drift, moved/import/removed⭐⭐⭐⭐
10Capstone Project3-tier production infrastructure, multi-env, CI/CD⭐⭐⭐⭐⭐

Reference materials:

  • Cheat Sheet — quick command and syntax lookup
  • Interview Questions — 60+ questions with answers
  • Skill Checklist — self-assessment at each level

Directory structure

terraform-mastery/
├── README.md
├── 00-setup/
├── 01-fundamentals/
│   ├── README.md                 ← theory
│   └── hands-on/                 ← runnable code + lab guide
├── 02-state-management/
├── ... (other modules)
├── 10-capstone-project/
└── reference/
    ├── cheat-sheet.md
    ├── interview-questions.md
    └── skill-checklist.md

Each module follows the same pattern:

  • README.md — the theory section: explains the "why", diagrams, best practices, common mistakes.
  • hands-on/.tf code you can actually run, plus LAB.md with step-by-step instructions and exercises.

Prerequisites

  • Basic familiarity with cloud concepts (AWS/Azure/GCP) — AWS is used throughout.
  • Comfortable with terminal/command line.
  • Basic Git knowledge.
  • (Helpful) Some understanding of networking (VPC, subnet, security group) and Linux.

You don't need a paid AWS account. Module 00 covers LocalStack — a local AWS emulator that lets you practice for free without any risk of surprise charges.


How to get the most out of this

  1. Read the README for each module to get the concepts.
  2. Do the hands-on lab — type the code yourself, run plan/apply, see what happens.
  3. Break things intentionally — introduce errors on purpose, read what Terraform says, then fix it.
  4. Do the exercises without peeking at the answers first.
  5. Explain it back to yourself in plain language (Feynman technique).
  6. At the end of each week, go through the Skill Checklist.

The philosophy behind this series

"You don't learn Terraform by reading about it. You learn it by running terraform apply, corrupting a state file, and figuring your way out."

Every lab has:

  • A clear objective
  • Complete, runnable code
  • A "break it" scenario based on real mistakes
  • Exercises without provided solutions
  • Completion criteria so you know when you're actually done
Share: