A routine `terraform apply` replaced a security group and the site went down for 4 minutes.

IntermediateTroubleshootingSite down
Answer

Likely causes → A change to an immutable attribute (name, description, vpc_id) forces -/+ destroy and then create replacement. The ENIs lost the old group before the new one attached, or inline rules and aws_security_group_rule resources fought each other.

Diagnose → Read the plan output in the CI log for must be replaced and # forces replacement. Check CloudTrail for DeleteSecurityGroup and RevokeSecurityGroupIngress at the outage time.

Fix → Re-apply the rules (or roll back the code), confirm targets are healthy.

Prevent →

lifecycle { create_before_destroy = true }

Use name_prefix instead of name, fail CI on any replacement of network resources without explicit approval, and use aws_vpc_security_group_ingress_rule resources instead of inline rules.

All Real-World Interview questions Roadmap: Interview readiness

More on Site down