Q: You need to import dozens of existing resources into module paths using Terraform import blocks. How do you make the import manageable?
Write the target module configuration first, add one import block per resource address, and import in small batches. After each batch, ru...
#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
Write the target module configuration first, add one import block per resource address, and import in small batches. After each batch, run terraform plan and adjust the HCL until Terraform shows no unexpected changes. For resources with immutable attributes, match the existing cloud configuration before the first apply. Large imports are state migrations, so review them like production changes.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Write the target module configuration first, add one import block per resource address, and import in small batches. After each ba."
⚡ 60-Second Elevator Pitch Talking Points
- Immediate Triage: Write the target module configuration first, add one import block per resource address, and imp
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement