How We Stopped Terraform Drift from Surprising On-Call
A real story of removing console-only changes, adding drift detection, and getting Terraform back in charge.
Key takeaways
A real story of removing console-only changes, adding drift detection, and getting Terraform back in charge.
On this page
How We Stopped Terraform Drift from Surprising On-Call#
Our worst incident of last year started with a simple question: “Why is there an EC2 instance we can't find in Terraform?”
The Incident#
- An engineer had manually patched a production ASG during an outage.
- Months later, we scaled out and Terraform attempted to “fix” the ASG back to its old shape.
- That change reduced capacity during a peak event.
Fix 1: Guardrails in Terraform#
- Enabled Terraform Cloud with VCS-driven runs only.
- Turned off direct access to production AWS credentials except via break-glass.
Fix 2: Regular Drift Detection#
- Added a nightly job:
```bash terraform plan -detailed-exitcode || echo "Drift detected" ```
- Wired the exit code into Slack with a short summary.
Fix 3: Runbook and Culture#
- Wrote a runbook for “emergency changes” that includes:
- ticket link,
- time-bounded console access,
- follow-up PR to codify the change in Terraform.
Drift still happens, but on-call no longer learns about it at the worst possible moment.
Get the DevOps Troubleshooting Cheat Sheet
Subscribe and get our free one-page reference for the errors that eat an afternoon — CrashLoopBackOff, OOMKilled, Terraform state locks, and more — plus new guides as we publish them.
Systemd Tricks We Use to Keep Services Boring
Concrete systemd unit patterns that reduced flakiness: restart policies, resource limits, and structured logs.
Platform Engineering and Internal Developer Platforms in 2025
Why IDPs are core to modern DevOps. Self-service, standardized CI/CD, and better developer experience.
More from Infrastructure
Explore more articles in this category
Redis vs Memcached: Choosing a Cache in 2026
Both are fast in-memory stores, and both get picked by habit more than by requirements. Here is what actually differs and when each one is the right call.
Vault vs AWS Secrets Manager vs Doppler: Choosing a Secrets Tool
One is a full secrets platform, one is AWS-native and hands-off, and one is built for developer workflow. Picking by feature list alone misses the real tradeoff.
How DNS Works (Explained Simply)
A developer-friendly walk through DNS resolution, record types, TTL, and the caching quirks that cause real production bugs.
You might have missed
Evergreen posts worth revisiting.