Beginner

Terraform Fundamentals

Install Terraform (or OpenTofu), provision a small set of AWS resources, and learn the core init/plan/apply/destroy workflow along with the dependency lock file that keeps provider versions reproducible.

~2h
0 / 8 steps
🚀
Intro

What you're building

Terraform is declarative infrastructure-as-code: you describe the end state you want in HCL (HashiCorp Configuration Language), and Terraform figures out what API calls are needed to get your real infrastructure to match it — creating, updating, or destroying resources as needed. One thing worth knowing before you start: in August 2023 HashiCorp relicensed Terraform from the open-source MPL 2.0 to the Business Source License (BSL), which restricts building competing commercial offerings on top of it but doesn't affect normal internal use. In response, a community fork called OpenTofu (governed by the Linux Foundation, CNCF sandbox project) forked from the last MPL-licensed release and remains fully open-source. The two tools are near drop-in replacements — this project uses the terraform CLI, but everything here works identically with the tofu CLI if you'd rather use OpenTofu.

You'll write a small configuration that provisions an S3 bucket and an EC2 instance, walk through the full init → plan → apply → destroy lifecycle, and learn why the .terraform.lock.hcl file that Terraform generates matters enough to commit to version control.

🔨

Step 1 — Install Terraform and verify AWS credentials

🔨

Step 2 — Write your first configuration

🔨

Step 3 — init, plan, and apply

🔨

Step 4 — Add a resource with a dependency and inspect state

🔨

Step 5 — Make a change and destroy

🎯
Secret Mission

Secret Mission: break and fix a plan

🧹
Wrap Up

Before You Go

Pro

Test what you just learned

Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.

Log in to unlock