← Lessons/State — Break It & Recover
← State — Break It & Recover

Heal the drift

Learn

Your code is the source of truth

Applying reconciles the real world to the configuration:

demo_server.web: Modifying...
demo_server.web: Modifications complete

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Code, state and the real server agree on cpu = 2 again. That's Terraform's whole model: it continuously pulls reality back to the code.

In real life, before you apply, ask why it drifted. If the console change was an emergency fix that should stay (more CPU during an incident), the right move is to update the code to cpu = 8 and let the plan come back clean. Applying blindly would quietly undo someone's fix. Drift is information: either the code or the world is wrong, and only a person can tell which.

Your code is the source of truth. Run apply to reconcile Real Infrastructure back to your configuration (cpu → 2). After this, all three worlds agree again — watch the drift highlight disappear in the Inspector.

Loading...

State Inspector

State

Terraform's memory

empty — nothing here yet

Real Infrastructure

the actual world

empty — nothing here yet