Q: How do you implement zero-downtime Terraform changes for an ALB?
For listener rule changes: create new rule before deleting old. create_before_destroy. For target group changes: add new TG to ALB, shift traffic, remove old TG. Use weighted routing to gradually shift.
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."
Production Solution & Architecture
For listener rule changes: create new rule before deleting old. create_before_destroy. For target group changes: add new TG to ALB, shift traffic, remove old TG. Use weighted routing to gradually shift.
- Immediate Triage: For listener rule changes: create new rule before deleting old. create_before_destroy. For targ
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Configuring application keepalive timeouts shorter than the Application Load Balancer idle timeout when addressing zero-downtime 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.
-
Overlooking Target Group health check path misconfigurations when registering new backend services
Pointing health checks to deep authenticated endpoints instead of dedicated
/healthzendpoints leads to false-positive target evictions. - 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.
- 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.