Skip to content

Commit

Permalink
elb_application_lb: also clean up the associate listeners (ansible-co…
Browse files Browse the repository at this point in the history
…llections#350)

state=`absent`: Properly remove the associated listeners before the final
removal of the object.

See: ansible/ansible#49291
  • Loading branch information
goneri authored Jan 12, 2021
1 parent e088eda commit 0cf5326
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- elb_application_lb - during the removal of an instance, the associated listeners are also removed.
5 changes: 5 additions & 0 deletions plugins/modules/elb_application_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ def create_or_update_elb(elb_obj):
def delete_elb(elb_obj):

if elb_obj.elb:
listeners_obj = ELBListeners(elb_obj.connection, elb_obj.module, elb_obj.elb['LoadBalancerArn'])
for listener_to_delete in [i['ListenerArn'] for i in listeners_obj.current_listeners]:
listener_obj = ELBListener(elb_obj.connection, elb_obj.module, listener_to_delete, elb_obj.elb['LoadBalancerArn'])
listener_obj.delete()

elb_obj.delete()

elb_obj.module.exit_json(changed=elb_obj.changed)
Expand Down

0 comments on commit 0cf5326

Please sign in to comment.