Hi, in this mini series I’m adding an overview of the exam content for the terraform associate 004 exam found here: https://developer.hashicorp.com/terraform/tutorials/certification-004/associate-review-004. Hope this helps you on your quest to pass the exam 🙂 look for more sections (1-8) under Terraform in the navigation bar.
Section 3 — Core Terraform Workflow
This is the most hands-on section and the one that clicks fastest when you actually run the commands. Expect a lot of “what does this command do” questions.
The workflow in one line
Write → Init → Plan → Apply → Destroy
Every Terraform project follows this same cycle every time, regardless of what you’re building.
3a — The workflow explained
Write — you create .tf files describing the infrastructure you want
Init — you run terraform init to set up the project
Plan — you run terraform plan to preview what will change
Apply — you run terraform apply to actually make it happen
Destroy — you run terraform destroy to tear it all down
3b — terraform init
Initialises a working directory. Run this first in any new project or after changing providers.
What it does:
- Downloads and installs the providers declared in your config
- Sets up the backend (where state is stored)
- Creates the
.terraformfolder
Key exam point — you must re-run terraform init any time you add or change a provider.
3c — terraform validate
Checks your config for syntax errors and internal consistency. Doesn’t connect to any cloud, doesn’t look at state — just checks the code is valid.
Run this before plan to catch obvious mistakes early.
3d — terraform plan
Shows you exactly what Terraform will do before doing it. Nothing gets created or changed — it’s purely a preview.
Output uses symbols:
+resource will be created-resource will be destroyed~resource will be updated in place-/+resource will be destroyed and recreated
Key exam point — you can save a plan to a file with terraform plan -out=myplan.tfplan and then apply that exact plan later with terraform apply myplan.tfplan. This is how teams ensure what was reviewed is exactly what gets applied.
3e — terraform apply
Executes the changes. By default it shows the plan first and asks you to type yes to confirm. You can skip confirmation with terraform apply -auto-approve but only do that in automation, not manually.
3f — terraform destroy
Destroys all infrastructure managed by the current state. Terraform figures out the right order to delete things automatically. Also asks for confirmation before doing anything.
This is your “tear it all down” command.
3g — terraform fmt
Formats your .tf files to follow the standard Terraform style. Think of it like a code formatter — consistent indentation, spacing, layout. Run it before committing code.
The Cheat Sheet
| Command | What it does |
|---|---|
terraform init | Set up the project, download providers |
terraform validate | Check config for errors |
terraform plan | Preview changes |
terraform apply | Make changes happen |
terraform destroy | Tear everything down |
terraform fmt | Format your code |
