Skip to content

Commit

Permalink
ec2_asg: Change purge_tags default value to False (ansible-collection…
Browse files Browse the repository at this point in the history
…s#1064)

ec2_asg: Change purge_tags default value to False

SUMMARY

Changed default value of purge_tags to False.

With the addition of purge_tags to ec2_asg module ansible-collections#960, the default value was kept to True similar to many other modules in this collection and also as specified in ansible dev guide.
With this addition, the issue was discovered that there is a possibility of this change breaking existing playbooks for users if they don't update their playbooks and specify purge_tags: false where required.
This PR's change will prevent accidental breakage.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_asg

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Woolley <[email protected]>
Reviewed-by: Alina Buzachis <None>
  • Loading branch information
mandar242 authored Apr 14, 2022
1 parent a3d519d commit d0c9f1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/1064-ec2_asg_change_purge_tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- ec2_asg - Change the default value of ``purge_tags`` to ``false``. Restores previous behaviour (https://github.com/ansible-collections/community.aws/pull/1064).
4 changes: 2 additions & 2 deletions plugins/modules/ec2_asg.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
description:
- If C(true), existing tags will be purged from the resource to match exactly what is defined by I(tags) parameter.
- If the I(tags) parameter is not set then tags will not be modified.
default: true
default: false
type: bool
version_added: 3.2.0
health_check_period:
Expand Down Expand Up @@ -1861,7 +1861,7 @@ def main():
wait_timeout=dict(type='int', default=300),
state=dict(default='present', choices=['present', 'absent']),
tags=dict(type='list', default=[], elements='dict'),
purge_tags=dict(type='bool', default=True),
purge_tags=dict(type='bool', default=False),
health_check_period=dict(type='int', default=300),
health_check_type=dict(default='EC2', choices=['EC2', 'ELB']),
default_cooldown=dict(type='int', default=300),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
tags:
- tag_c: 'value 3'
propagate_at_launch: no
purge_tags: true
register: output

- assert:
Expand All @@ -126,6 +127,7 @@
ec2_asg:
name: "{{ resource_prefix }}-asg-tag-test"
tags: []
purge_tags: true
register: add_empty

- name: Get asg info
Expand Down Expand Up @@ -155,7 +157,6 @@
propagate_at_launch: yes
- snake_case: "simple_snake_case"
propagate_at_launch: no
purge_tags: false
register: add_result

- name: Get asg info
Expand Down Expand Up @@ -188,7 +189,6 @@
propagate_at_launch: yes
- snake_case: "simple_snake_case"
propagate_at_launch: no
purge_tags: false
register: add_result

- name: Get asg info
Expand All @@ -210,6 +210,7 @@
propagate_at_launch: no
- tag_b: 'val_b'
propagate_at_launch: yes
purge_tags: true
register: add_purge_result

- name: Get asg info
Expand Down Expand Up @@ -275,7 +276,6 @@
propagate_at_launch: no
- Title Case: "Hello Cruel World"
propagate_at_launch: yes
purge_tags: false
register: add_result

- name: Get asg info
Expand Down Expand Up @@ -325,6 +325,7 @@
ec2_asg:
name: "{{ resource_prefix }}-asg-tag-test"
tags: []
purge_tags: true
register: add_empty

- name: Get asg info
Expand Down

0 comments on commit d0c9f1a

Please sign in to comment.