Terraform & IaC

Plan, Apply & Lifecycle

The core workflow and how Terraform decides what to change.

30 min read beginner 3 objectives

Status

Not started

What you will learn

  • Read a plan
  • Apply changes
  • Use lifecycle rules

New to this? Start here

The basics, in plain English

Terraform never changes things blindly. First it shows you a plan: exactly what it will add, change, or destroy. You read it, and only then do you apply it. This preview step prevents costly mistakes.

plan
A preview of the exact changes Terraform will make, shown before anything happens.
apply
The step that actually carries out the changes from the plan.
destroy
Tearing down the resources Terraform created.
Diff
The list of differences between what exists now and what your files describe.
Always read the plan
The golden habit: never apply without checking the plan, especially for destroys.
01

Plan then apply

plan shows the diff before anything changes. Always read it. apply executes; lifecycle blocks control create/destroy ordering.

Try it yourself

bash
$terraform init
Download providers and set up the working directory.
$terraform plan -out tfplan
Preview changes and save them to a plan file.
$terraform apply tfplan
Apply exactly the changes you reviewed in the plan.
↳ lines explain what each command does — only the commands get copied

Finished this topic?

Mark it done to earn 100 XP and keep your streak alive.