Error waiting for internet gateway (igw-0980f3434343410c209) to detach: timeout while waiting for state to become 'detached'

Viewed 1264

export TF_WARN_OUTPUT_ERRORS=1

terraform destroy

Error: Error applying plan:

2 error(s) occurred:

  • module.dev_vpc.aws_internet_gateway.eks_vpc_ig_gw (destroy): 1 error(s) occurred:

  • aws_internet_gateway.eks_vpc_ig_gw: Error waiting for internet gateway (0980f3434343410c209) to detach: timeout while waiting for state to become 'detached' (last state: 'detaching', timeout: 15m0s)

  • module.dev_vpc.aws_subnet.production_public_subnets[1] (destroy): 1 error(s) occurred:

  • aws_subnet.production_public_subnets.1: error deleting subnet (subnet-04ad0a3a0171c861c): timeout while waiting for state to become 'destroyed' (last state: 'pending', timeout: 20m0s)

2 Answers

There was a load balancer attached to EC2 instance. I logon to AWS console, manually removed the load balancer, ran terraform destroy. It is successfully destroyed.

Same issue I also faced, deployed whole infra with Terraform but deployed application manually and that in process created an ALB, small but painful. So first remove the infra which is not part of Terraform and then destroy will work fine.

Related