Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS subnet deletion doesn't account for an ELB's network interface and gives a meaningless error #655

Closed
hashibot opened this issue Jun 13, 2017 · 5 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@hashibot
Copy link

This issue was originally opened by @randomvoids as hashicorp/terraform#13296. It was migrated here as part of the provider split. The original body of the issue is below.


I attempted to modify the cidr block of a aws_subnet which requires the deletion/re-creation of the subnet. Within terraform I also had an aws_elb defined that attached a network interface to that subnet. When running 'terraform apply' the command timed out with

* aws_subnet.public_az1 (destroy): 1 error(s) occurred:

* aws_subnet.public_az1: Error deleting subnet: timeout while waiting for state to become 'destroyed' (last state: 'pending', timeout: 5m0s)

When running it in the AWS console it will immediately come back with:

The following subnets contain one or more network interfaces, and cannot be deleted until those network interfaces have been deleted.

Terraform should catch and immediately return that error instead of just timing out after 5 minutes with a generic error. This should also be detected during the plan stage.

That and/or handle the cascading deletions required to fully delete a subnet.

I'm using Terraform v0.9.2

@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@awilkins
Copy link

See also #151 - agree that ELB dependencies on subnets don't appear to be treated as such for the purpose of dependency graph construction.

@robertoandrade
Copy link

I'm also seeing this happen with EFS attachments to the ENIs associated with the subnets. It doesn't seem to try to destroy the EFS file systems in order to release the ENIs to then be able to destroy the subnet.

@radeksimko radeksimko added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 27, 2018
@fstephany
Copy link

fstephany commented Nov 8, 2019

I also face this issue after reducing the count number of aws_subnet. Terraform get stuck.

module.app.aws_subnet.public[0]: Still destroying... [id=subnet-0e4550ce89d3c4588, 20m0s elapsed]
Error: Error deleting subnet: timeout while waiting for state to become 'destroyed' (last state: 'pending', timeout: 20m0s)

If I try to manually destroy the subnet in the console, it says that the subnet still has network interface attached to it.

I do not have a clue how to solve this without fiddling in the console (and thus messing the tfstate).

@radeksimko
Copy link
Member

@robertoandrade EFS may need a separate issue as that may create ENIs with different lifecycle and naming conventions. We may be able to address that.

In regards to load balancers - these are being discussed in #151 where I also posted full repro case. I'm going to close this as duplicate in favour of #151 to keep discussion in one place. I hope you don't mind.

@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

5 participants