diff --git a/changelogs/fragments/1064-ec2_asg_change_purge_tags.yml b/changelogs/fragments/1064-ec2_asg_change_purge_tags.yml new file mode 100644 index 00000000000..81324304b46 --- /dev/null +++ b/changelogs/fragments/1064-ec2_asg_change_purge_tags.yml @@ -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). diff --git a/plugins/modules/ec2_asg.py b/plugins/modules/ec2_asg.py index f95fb329ce5..0aa16aeaa0b 100644 --- a/plugins/modules/ec2_asg.py +++ b/plugins/modules/ec2_asg.py @@ -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: @@ -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), diff --git a/tests/integration/targets/ec2_asg/roles/ec2_asg/tasks/tag_operations.yml b/tests/integration/targets/ec2_asg/roles/ec2_asg/tasks/tag_operations.yml index 500969a4fb7..b1eba8d5919 100644 --- a/tests/integration/targets/ec2_asg/roles/ec2_asg/tasks/tag_operations.yml +++ b/tests/integration/targets/ec2_asg/roles/ec2_asg/tasks/tag_operations.yml @@ -102,6 +102,7 @@ tags: - tag_c: 'value 3' propagate_at_launch: no + purge_tags: true register: output - assert: @@ -126,6 +127,7 @@ ec2_asg: name: "{{ resource_prefix }}-asg-tag-test" tags: [] + purge_tags: true register: add_empty - name: Get asg info @@ -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 @@ -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 @@ -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 @@ -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 @@ -325,6 +325,7 @@ ec2_asg: name: "{{ resource_prefix }}-asg-tag-test" tags: [] + purge_tags: true register: add_empty - name: Get asg info