What This Course Is For
The basics of Terraform fit in an afternoon: describe some infrastructure in a
file, run terraform apply, and it appears. Working on a real team's
Terraform is a different job. You rename a resource and the plan wants to
destroy a database. Two people apply at the same time. Staging somehow plans
to delete production. Someone created a server by hand last year, and now it
needs to be managed properly. A password turns up in a file nobody meant to
share.
This course teaches the skills that handle those situations: reading a plan before trusting it, making configuration reusable, keeping shared state safe, running several environments, changing and adopting infrastructure without recreating it, testing, keeping secrets out, and reviewing and automating changes as a team. Each skill is explained when you reach it. The aim throughout is to predict what Terraform will do before you run it, check the result with evidence afterwards and recover calmly when something goes wrong.
Who It Is For
The course is intermediate. You should be able to run commands in a terminal, set an environment variable, edit a plain-text file and make a Git commit and tag. The second lesson checks the terminal skills, and the lesson on sharing modules includes a short Git refresher.
You do not need previous Terraform experience. The first two modules rebuild the core workflow from the beginning, at a brisk pace, so that every later lesson has a solid base. If infrastructure as code is completely new to you, expect to spend longer on those modules. You do not need to know Docker beyond installing it, because the third lesson teaches the parts the course uses, and you do not need a cloud account or any programming experience.
The Practice Stack You Will Build
Every exercise manages real infrastructure, but the infrastructure runs in Docker on your own computer. By the end of the course, Terraform manages the stack in this diagram.

Start at the top. Your terminal is where you run terraform and curl. The
solid green arrow is Terraform creating and changing objects: it asks the
Docker Engine, through Docker's programming interface, to create containers,
networks and the other objects your configuration describes. The grey arrows
are ordinary web requests: curl calls a proxy, and the proxy forwards the
request to an app container. The dashed blue path is Terraform reading and
writing its state, the record of what it manages, which by then lives in a
small PostgreSQL database that the whole team can share.
Inside Docker there are two environments, dev and staging. Each has its own private network, its own proxy on its own port and its own apps, built from the same reusable code. You will build this stack one piece at a time: a single container first, then several apps, a proxy, reusable modules, shared state and finally the second environment.
Why Docker rather than a cloud account? Docker objects behave like real infrastructure for the purposes of this course. They have IDs, they can fail (a port can already be in use), and someone can change or delete them behind Terraform's back. Practising on them costs nothing and needs no account. HashiCorp's own getting-started tutorials use Docker in the same way.
Docker is not a cloud provider, though. It has no cloud-style identity and permission system, no regions and no bill, and many container settings cannot be changed without replacing the container, so you will see more replacements than you would with some cloud resources. The third lesson explains what local practice can and cannot show you. The Terraform skills themselves transfer to any provider.
How the Modules Build on Each Other
- Start Here: install Terraform and Docker and learn the Docker objects you will manage.
- Terraform Core Workflow: how Terraform decides what to do, your first configuration, reading plans, dependencies and version pinning.
- Flexible Configuration: variables, outputs, expressions, many instances from one block, and generated files.
- Control Change: controlling when Terraform replaces or deletes things.
- Modules: turning configuration into reusable, versioned building blocks.
- State and Environments: shared, locked state and separate environments.
- Refactor, Import and Recover: renaming, adopting and releasing infrastructure without recreating it, drift and failed applies.
- Validate, Test and Protect: conditions, automated tests and secrets.
- Team Workflow: repository layout, review, automation and diagnosis.
- Final Challenge: take over a messy setup and leave it tested and safe.
The order follows what each module needs. Environments come after modules because each environment calls the same module. Refactoring comes after state because moving and importing are changes to state. Testing comes after modules because modules are what you test. The final challenge combines everything without step-by-step instructions.
Versions This Course Uses
The exercises need Terraform 1.16 or later and were written against 1.16.5, the latest release when the course was planned. Terraform changes regularly, so lessons name the release that introduced each newer feature, such as "added in 1.15". That helps if your team runs an older version.
Each exercise pins the versions it uses. Providers are the plugins that let Terraform talk to a system; the course uses the Docker provider throughout, then a few more for specific lessons. Container images are also pinned to exact versions, so your results match the lessons.
HashiCorp distributes Terraform 1.6 and later under the Business Source License 1.1, a source-available licence. OpenTofu is a separate, open-source tool with a very similar language and workflow. Much of what you learn applies to it, but the two differ in places, and the exercises here are tested only with Terraform.
Three Ways to Study a Lesson
Every lesson has three views of the same material:
- Full Course teaches the topic: the problem it solves, how Terraform behaves, a worked example and, in practical lessons, an exercise you run yourself.
- Revision helps you recall the reasoning after you have studied the Full Course: the distinctions, the decisions and the common mistakes.
- Quick Reference lists syntax, commands and decisions in a compact form, with the warnings that apply to them.
Start with Full Course. The shorter views assume you have already worked through it; they are for returning to a topic, not for skipping it.
How the Practice Works
Practical lessons end with an exercise that runs on your computer. Each
exercise works in its own folder, ~/terraform-practice/<exercise-id>, and
setup commands in the lesson create its starting files, so everyone starts
from the same point and you never download course files.
Two rules keep the practice separate from anything else on your computer:
- Owned names. Every container, network and volume the course creates has
a name starting with
tfp-. When an exercise checks or cleans up, it looks only fortfp-names, so it never touches your other containers. - Local ports. Practice apps listen only on
127.0.0.1, the address that means "this computer", using ports 18080 to 18089, 15432 and 15433. Other devices on your network cannot reach them. If one of those ports is already in use, each exercise shows which value to change.
Most exercises ask you to predict what Terraform will do before you run
plan or apply. Write the prediction down. Comparing it with the real plan
is the fastest way to find out what you actually understand.
Output shown in the lessons is marked illustrative. IDs, timings and hashes will differ on your computer, and each lesson says which parts to compare. Read a command group's explanation before running it, then copy the whole group rather than retyping it.
Containers keep running after you close the terminal. That is why every
exercise ends with cleanup: terraform destroy removes what the exercise
created, a check confirms no tfp- objects remain, and the exercise folder is
removed after you confirm its path. To restart an exercise, run its cleanup
and then its setup again.
Safety and Cost
The course needs no cloud account and creates nothing that costs money. Docker Desktop has its own licence terms, which the next lesson explains.
Terraform can delete things; that is part of its job. The exercises only ever
create and remove tfp- objects in your local Docker. Run them in a normal
terminal on your own computer, not in a terminal that is connected to a shared
or remote Docker engine, such as a team build server. The next lesson shows how
to check which Docker engine your terminal talks to.
Secrets in the exercises are obviously fake practice values. Never put a real password or key into a practice file.
Checking Your Own Work
Each exercise says how to check the result: usually by reading the plan,
listing what Terraform manages with terraform state list, looking at the
containers with docker ps and calling the app with curl. A command that
finishes with "Apply complete!" is not enough on its own. The check is whether
the infrastructure ended up in the state and behaviour the exercise describes.
Questions have a Your answer box. Write your answer before opening the reasoning; comparing afterwards shows what you actually understood.
There is no automatic grading. Marking a lesson complete records your reading progress; it does not prove you can do the task. The Final Challenge is where you show that you can combine the skills without being guided through them.
What the Course Leaves Out
The course teaches Terraform itself, using Docker for practice. It does not teach a cloud provider's services, writing your own providers, HashiCorp's hosted services and policy tools (HCP Terraform, Terraform Enterprise, Sentinel and Stacks), CDK for Terraform, third-party wrappers and scanners such as Terragrunt, Atlantis, TFLint and Checkov, Kubernetes or configuration management tools. Experimental Terraform features are left out too; a few newer features get a short note so that you recognise them.
Check Your Understanding
- You finish an exercise, skip its cleanup and close the terminal. What is still running, and how would you find it later?
- Why does every practice object have a name starting with
tfp-, and why do the practice apps listen only on127.0.0.1? - A learner runs
terraform apply, sees "Apply complete!" and marks the exercise done. What else should they check? - Which parts of the course need an internet connection, an account or money?
Answer and Reasoning
- The containers, networks and volumes the exercise created are still there:
Docker objects do not stop when a terminal closes. The third lesson shows
how to list them with
docker ps. The clean fix is to return to the exercise folder and runterraform destroy, because Terraform knows exactly what it created there. - The prefix lets checks and cleanup target only the course's own objects, so
your other containers are never touched.
127.0.0.1means "this computer", so other devices on your network cannot reach the practice apps. - The behaviour the exercise asks for: for example, that
curlreturns the expected text, thatdocker psshows the expected containers, or thatterraform state listlists the expected resources. A finished command shows that Terraform did something, not that it did the right thing. - Internet access is needed to download Terraform, providers and container images. No account is needed and nothing costs money, apart from Docker Desktop's licence terms for larger organisations, explained in the next lesson.