diff --git a/cloud/amazon/ec2_asg.py b/cloud/amazon/ec2_asg.py index c20f2d500d8..ac5e501bbee 100644 --- a/cloud/amazon/ec2_asg.py +++ b/cloud/amazon/ec2_asg.py @@ -363,15 +363,15 @@ def create_autoscaling_group(connection, module): for tag in asg_tags: want_tags[tag.key] = [tag.value, tag.propagate_at_launch] + dead_tags = [] for tag in as_group.tags: have_tags[tag.key] = [tag.value, tag.propagate_at_launch] - dead_tags = [] if not tag.key in want_tags: changed = True dead_tags.append(tag) - if dead_tags != []: - connection.delete_tags(dead_tags) + if dead_tags != []: + connection.delete_tags(dead_tags) if have_tags != want_tags: changed = True