Properly delete Amazon EC@ elastic load balancer

Deleting the elastic load balancer (ELB) sort of works (using http://docs.ansible.com/ansible/ec2_elb_lb_module.html) but it does not delete ELB elastic network interfaces (ENI), these are deleted later by Amazon background process. This is mostly invisible to the user.

The problem is that the ENI is in the same subnet(s) and uses the same security group(s) as the ELB. Which means that deleting of ELB security group(s) and subnet(s) somewhat mysteriously fails with error " resource sg-xxxxxxxx has a dependent object". Re-running the delete task later on (usually few minutes later) works (ENI is removed by Amazon in the meantime).

This is also discussed at http://unrouted.io/2015/04/12/elb-deletion/

Is this a known problem? Any ideas how to handle it now? Any plans to handle it by ec2_elb_lb module?

It seems that currently there is no workaround possible (in 1.9.2, I see that ec2_eni module is available in 2.0)

Any ideas how to handle it in 2.0? It seems that the only way to figure out that the ENI belongs to a particular ELB is the description, I don’t see how to check if ENI with a given description exists.

Thanks!

erik

it might be something we need to add to the modules, most of them
depend on boto, so if the capability is there it should not be hard to
add