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 committed Jan 12, 2021
1 parent 02794a9 commit ea5dc08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 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 ea5dc08

Please sign in to comment.