⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Terraform & IaC Interview Questions Scenario 98 of 120 in Terraform & IaC
Senior DevOps / SRE [L2] Terraform Terraform Modules & State Production Scenario [L2]
🎯 Target Role / Context: Terraform Scenario #93 (L2) · Use VPC ID from another module

Q: Deleting a load balancer through Terraform fails because dependent listeners and target groups are still attached. How do you debug this?

Inspect the dependency graph and the cloud-side error to find the resource still in use.

#Terraform #L2 #IaC #Cloud Infrastructure
🎙️ 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
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's HashiCorp Certified Terraform Associate (003) Interactive Labs covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: "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."

1️⃣

Production Solution & Architecture

Inspect the dependency graph and the cloud-side error to find the resource still in use. Terraform usually infers dependencies from references, but dependencies can be hidden when values are passed as plain strings or created outside the same root module. Add missing references or explicit depends_on where the relationship is real, then rerun the plan. Fix the dependency model instead of repeatedly retrying the same destroy.

💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Inspect the dependency graph and the cloud-side error to find the resource still in use. Terraform usually infers dependencies fro."
⚡ 60-Second Elevator Pitch Talking Points
  • Immediate Triage: Inspect the dependency graph and the cloud-side error to find the resource still in use. Terraf
  • Run targeted verification commands before modifying configuration.
  • Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Configuring application keepalive timeouts shorter than the Application Load Balancer idle timeout When backend app keepalive is shorter than the ALB timeout (default 60s), the app closes connections while ALB routes new requests, triggering intermittent 502 errors.
  2. Overlooking Target Group health check path misconfigurations when registering new backend services Pointing health checks to deep authenticated endpoints instead of dedicated /healthz endpoints leads to false-positive target evictions.
  3. Neglecting cross-zone load balancing configuration on Network Load Balancers (NLB) NLBs route traffic within the receiving Availability Zone by default; without cross-zone balancing enabled, uneven client traffic skews backend target load.
  4. Failing to inspect ALB access logs via Amazon Athena during intermittent 5xx latency spikes ALB access logs reveal request processing time, target response time, and exact client TLS ciphers necessary to diagnose edge latency anomalies.
Advertisement
Want more Terraform & IaC scenarios?
Explore our complete collection of scenario-based Terraform & IaC interview runbooks.
Browse All Terraform & IaC Questions →