Q: You need one Terraform pipeline to deploy only the modules that changed in a monorepo. How would you design that?
Split the repo into independent root modules, each with its own backend key and pipeline target. In CI, detect changed paths, map them to...
#Terraform #Use VPC ID from another module #L3 #IaC #Cloud Infrastructure #Terraform State
🎙️ Candidate Opening & Architectural Context
""Treat Terraform code with the same rigor as application code: pre-merge plans, state locks, and automated drift detection. 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
Split the repo into independent root modules, each with its own backend key and pipeline target. In CI, detect changed paths, map them to affected root modules, and run terraform plan only for those modules. Keep shared modules versioned or at least include dependency rules so that a shared module change triggers plans for all consumers. This scales much better than one giant root module with a single state file.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Split the repo into independent root modules, each with its own backend key and pipeline target. In CI, detect changed paths, map ."
⚡ 60-Second Elevator Pitch Talking Points
- Immediate Triage: Split the repo into independent root modules, each with its own backend key and pipeline target
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement