Interview Prep/Terraform/Import Refactoring Drift and Lifecycle

How do you find out that someone changed infrastructure outside Terraform?

BeginnerScenarioImport Refactoring Drift and Lifecycle
Answer

Situation read → Console hotfix; code and reality have diverged.

What I'd do →

  1. Run terraform plan; drifted attributes appear as changes to revert.
  2. Use terraform plan -refresh-only to see only drift with no code changes mixed in.
  3. Automate a scheduled plan that alerts on exit code 2.

Why → Refresh reads real attributes from the cloud API and compares with state and code.

Interview tip → Drift detection is only useful if somebody owns the alert.

All Terraform questions Roadmap: Terraform in production

More on Import Refactoring Drift and Lifecycle