Terraform in Practice / Start Here

How this course works

Lesson 1 of 35. Open to read. No account needed.

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.

The practice stack. Your terminal runs terraform and curl. Terraform changes objects in the Docker Engine on your computer through the Docker API, and reads and writes state in a PostgreSQL state database container. The dev environment, on network tfp-dev-net, has a proxy on port 18080 that routes to two app containers, blue and green. The staging environment, on network tfp-staging-net, has a proxy on port 18081 and one app.

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

  1. Start Here: install Terraform and Docker and learn the Docker objects you will manage.
  2. Terraform Core Workflow: how Terraform decides what to do, your first configuration, reading plans, dependencies and version pinning.
  3. Flexible Configuration: variables, outputs, expressions, many instances from one block, and generated files.
  4. Control Change: controlling when Terraform replaces or deletes things.
  5. Modules: turning configuration into reusable, versioned building blocks.
  6. State and Environments: shared, locked state and separate environments.
  7. Refactor, Import and Recover: renaming, adopting and releasing infrastructure without recreating it, drift and failed applies.
  8. Validate, Test and Protect: conditions, automated tests and secrets.
  9. Team Workflow: repository layout, review, automation and diagnosis.
  10. 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 for tfp- 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

  1. You finish an exercise, skip its cleanup and close the terminal. What is still running, and how would you find it later?
  2. Why does every practice object have a name starting with tfp-, and why do the practice apps listen only on 127.0.0.1?
  3. A learner runs terraform apply, sees "Apply complete!" and marks the exercise done. What else should they check?
  4. Which parts of the course need an internet connection, an account or money?

Answer and Reasoning

  1. 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 run terraform destroy, because Terraform knows exactly what it created there.
  2. The prefix lets checks and cleanup target only the course's own objects, so your other containers are never touched. 127.0.0.1 means "this computer", so other devices on your network cannot reach the practice apps.
  3. The behaviour the exercise asks for: for example, that curl returns the expected text, that docker ps shows the expected containers, or that terraform state list lists the expected resources. A finished command shows that Terraform did something, not that it did the right thing.
  4. 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.

References

30 more lessons in the full course

Course access opens every lesson and adds revision notes, the Quick Reference, saved progress, bookmarks and your own notes.

INR 99 plus 18% GST. 90 days of online access. No auto-renewal.

Get the full course

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy