-2

I'm having an issue with AWS. I did deploy an application using Terraform, but when I try to destroy it, the process doesn't finish because of a subnet. That subnet was related to an EC2 instance that doesn't exist anymore. If I try to remove it via AWS console it says there is a network interface using that subnet. Ok, but when I try to remove the network interface it says it is in use, but the supposed thing that could be using it, the EC2 instance, was terminated. Would you know how can I get rid of this network interface?

Thanks in advance!

I did try to remove the components individually on AWS console without success.

  • 4
    Are you sure the ENI is/was associated with an EC2 instance and not a Lambda function, EIP, RDS instance, or load balancer or [something else](https://stackoverflow.com/questions/37232965/issue-when-trying-to-delete-vpc-and-network-interface)? – jarmod Feb 03 '23 at 23:26
  • Yes, I'm sure of this. In my conf I have an application load balancer supporting an application deployed in EC2 only. This ENI is associated to an availability zone that doesn't have anything deployed. – Israel Boudoux Feb 04 '23 at 11:13

1 Answers1

0

I think I figured out what happened. When I first run terraform apply, I had set up two availability zones. But then I decided to have just one availability zone, because I just wanted to work with one instance of the application. The point is that when using ELB, you MUST have at least two application instances, since it doesn't make sense to have a Load Balancer having just one app instance. When I run terraform apply with this new configuration, it applied the change partially, leaving an ALB instance available.

After removing the ELB from the Terraform configuration, everything worked fine!