Interview Prep/Terraform/Authentication and Cloud API Errors

Detaching an internet gateway fails: `Network vpc-0abc has some mapped public address(es). Please unmap those public address(es) before detaching the gateway.`

IntermediateTroubleshootingAuthentication and Cloud API Errors
Answer

Likely causes → Elastic IPs or public IPs (NAT gateways, instances, load balancers) are still in the VPC, possibly not managed by this stack.

Diagnose → aws ec2 describe-addresses --filters Name=domain,Values=vpc and check NAT gateways in the VPC.

Fix → Delete NAT gateways/EIPs/instances first, then destroy again. Make the IGW explicitly depend on nothing that outlives it.

Prevent → Keep the network stack's dependents in other stacks destroyed first.

All Terraform questions

More on Authentication and Cloud API Errors