The Terraform Core Workflow
The four commands that power every Terraform project, init, plan, apply, and destroy. Learn the complete workflow loop used by every DevOps engineer managing infrastructure as code.
The Four Commands That Power Terraform
No matter how large or complex your infrastructure becomes, every Terraform workflow follows the same simple loop built around four commands:
| Command | What it does | When to run it |
|---|---|---|
terraform init | Downloads providers, sets up the backend | Once per project, and after any provider/backend change |
terraform plan | Shows exactly what will change, no side effects | Every time before applying |
terraform apply | Creates, updates or deletes infrastructure | After reviewing and approving the plan |
terraform destroy | Removes all managed resources | When tearing down an environment |
This loop, write → init → plan → apply: is the heartbeat of Infrastructure as Code. You will repeat it for the entire lifetime of every Terraform project.
The Workflow in Practice
# 1. Write your configuration in .tf files, then initialise
terraform init
# 2. Preview every change before it happens
terraform plan
# 3. Apply after reviewing the plan output
terraform apply
# 4. Tear down when done
terraform destroy
The critical thing that separates Terraform from clicking through a cloud console is the plan step. Before any infrastructure changes, you see a precise diff, every resource to be created (+), updated (~), replaced (-/+), or deleted (-). Nothing is a surprise.
What This Section Covers
Each command has its own dedicated page with complete detail, real examples, and common pitfalls:
- terraform init: What init does internally, provider downloads, backend setup, and the lock file
- terraform plan: Reading the execution plan, understanding resource symbols, saving plan files, and targeting
- terraform apply: Applying changes safely, auto-approve in CI/CD, and what happens during apply
- terraform destroy: Safely tearing down environments and partial destroys
Start with terraform init →