Allow removal of target groups from ASGs (#25126)

An empty `target_group_arns` list represents no target groups.
This is different to not passing a `target_group_arns` list at all
which can signify no change.

Remove unnecessary empty list construction, as it must already be
an empty list to get to that point.
pull/25177/merge
Will Thames 8 years ago committed by Sloane Hertel
parent aa9ea3d43a
commit 3ca006ecbb

@ -694,10 +694,8 @@ def create_autoscaling_group(connection, module):
module.fail_json(msg="Failed to update Autoscaling Group.",
exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response))
# Update target groups if they are specified and one or more already exists
elif target_group_arns and as_group['TargetGroupARNs']:
elif target_group_arns is not None and as_group['TargetGroupARNs']:
# Get differences
if not target_group_arns:
target_group_arns = list()
wanted_tgs = set(target_group_arns)
has_tgs = set(as_group['TargetGroupARNs'])
# check if all requested are already existing

Loading…
Cancel
Save