← Lessons/Your First Resource
← Your First Resource

Read the state

Learn

Idempotency

Run plan again without changing anything:

No changes. Your infrastructure matches the configuration.

Terraform compared your configuration with state this time, found the server already recorded with exactly the arguments you asked for, and had nothing to do.

That's idempotency: running the same configuration twice gives the same result, and the second run changes nothing. It's what makes plan and apply safe to run again and again, from your laptop or a CI pipeline. Change an argument and the next plan shows just that difference; change nothing and it shows nothing.

Run plan once more. Because state already matches your config, you'll see No changes — that's idempotency. Then answer the questions below.

What does Terraform's state record?
Why did the second plan show No changes?

Your answers are checked when you run this step.

Interview prep

L2 covers two questions that come up in almost every Terraform interview.

What's the difference between plan and apply?

plan is a read-only preview: it diffs your desired config against state and the real world and shows what would change. apply actually makes those changes and updates state. You always plan first so there are no surprises.

What is Terraform state and why does it matter?

State is Terraform's record of the real resources it manages — the mapping from your config to real-world IDs. It's how Terraform knows what already exists, so a re-apply with no changes is a no-op (idempotency). Lose or corrupt it and Terraform no longer knows what it owns.

Loading...

State Inspector

State

Terraform's memory

empty — nothing here yet

Real Infrastructure

the actual world

empty — nothing here yet