Course contentsShow
← Cloud and Infrastructure
Lesson 702 of 2,98913. Infrastructure as Code FoundationsFree lesson

State Reconciliation

Learn how IaC tools compare state files with actual infrastructure to detect drift and plan changes.

State Reconciliation

What you'll learn: How IaC tools detect differences between your state file and actual infrastructure to prevent drift and plan safe changes.

What Is State Reconciliation?

State reconciliation is the process where Infrastructure as Code tools compare what's recorded in the state file (your expected infrastructure) against what actually exists in your cloud provider. Think of it like checking your bank statement against your receipts—you're making sure reality matches your records.

When you run a plan or preview command, your IaC tool performs this reconciliation automatically. It asks: "Does my state file say there should be 3 servers, but the cloud shows only 2? Did someone manually change a configuration setting through the console?"

How Reconciliation Works

The IaC tool performs three key comparisons:

  1. Resources in state vs resources in cloud – Identifies missing or extra resources
  2. Configuration in state vs configuration in cloud – Detects modified settings, tags, or properties
  3. Dependencies and relationships – Ensures connections between resources remain intact

If differences are found, this is called drift. The tool then generates a plan showing exactly what changes are needed to bring reality back in line with your declared configuration.

Why This Matters

Without reconciliation, you'd have no way to know if:

  • Someone made manual changes through the cloud console
  • A resource was accidentally deleted
  • Your infrastructure no longer matches your configuration files

This process is your safety net—it prevents you from accidentally destroying working infrastructure and gives you confidence that your next "apply" will do exactly what you expect.

Key Takeaway: State reconciliation compares your state file against real cloud infrastructure to detect drift and generate accurate change plans, ensuring your IaC operations are safe and predictable.