Q: During an incident, someone suggests using `terraform apply -target` to update only one resource. When is that acceptable?
-target can be useful for a narrow recovery action, such as recreating one broken dependency, but it should not become a normal deploymen...
#Terraform #Use VPC ID from another module #L3 #IaC #Cloud Infrastructure
🎙️ Candidate Opening & Architectural Context
""When terraform plan shows unexpected changes, my golden rule is: never apply blindly. Investigate the diff first. 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️⃣
Production Solution & Architecture
-target can be useful for a narrow recovery action, such as recreating one broken dependency, but it should not become a normal deployment method. It bypasses Terraform's full graph planning, so related resources may be left inconsistent. After the emergency action, run a normal terraform plan for the whole root module and reconcile any remaining changes.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: -target can be useful for a narrow recovery action, such as recreating one broken dependency, but it should not become a normal de."
⚡ 60-Second Elevator Pitch Talking Points
- Immediate Triage: -target can be useful for a narrow recovery action, such as recreating one broken dependency, b
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement