Interview Prep/Terraform/Lost, Corrupted and Drifted State

A plan shows an RDS instance's `engine_version` going from `15.8` back to `15.4`. Nobody changed it.

IntermediateTroubleshootingLost, Corrupted and Drifted State
Answer

Likely causes → auto_minor_version_upgrade = true let AWS upgrade the engine during a maintenance window; your code still pins 15.4. Downgrading isn't possible, so the apply would fail.

Diagnose → aws rds describe-db-instances --db-instance-identifier prod-db --query 'DBInstances[0].EngineVersion'

Fix → Pin only the major version (engine_version = "15") so minor upgrades don't show as drift, or update code to 15.8. Alternatively ignore_changes = [engine_version].

Prevent → Decide who owns upgrades: either AWS (major-only pin) or Terraform (auto minor off, explicit bumps via PRs).

All Terraform questions Roadmap: Terraform in production

More on Lost, Corrupted and Drifted State