Q: `terraform plan` shows changes to a resource that you didn't touch. Why might this happen?
Several reasons:
#Terraform #State & Locking #L2 #IaC #Cloud Infrastructure #Terraform State
🎙️ Candidate Opening & Architectural Context
""Managing infrastructure as code across multiple teams requires disciplined state management and locking. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
Several reasons:
- Provider upgrade — a newer provider version may compute resource attributes differently.
- Drift — someone changed the resource manually in the console. Plan detects the difference.
- Sensitive attribute — some resources always show as changed due to how Terraform handles sensitive fields (passwords, keys).
- Computed values — some attributes are computed by the cloud provider and Terraform can't know them until apply time. Shows as
(known after apply).
2️⃣
Remediation & Permanent Safeguards
Check terraform show to see what the current state says vs what the config says. --- ## 🔵 Modules & Structure
- Timestamp/random changes — some providers generate new values on each plan.
- Deprecated attribute — provider changed default for an attribute.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Provider upgrade — a newer provider version may compute resource attributes differently.."
⚡ 60-Second Elevator Pitch Talking Points
- Provider upgrade — a newer provider version may compute resource attributes differently.
- Drift — someone changed the resource manually in the console. Plan detects the difference.
- Sensitive attribute — some resources always show as changed due to how Terraform handles sensitiv...
Advertisement