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 fa91232cbe6..4ba2036e304 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: @@ -1852,7 +1852,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 2f9cc118c4f..1a0874dbb47 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 @@ -85,6 +85,7 @@ tags: - tag_c: 'value 3' propagate_at_launch: no + purge_tags: true register: output - assert: @@ -109,6 +110,7 @@ ec2_asg: name: "{{ resource_prefix }}-asg-tag-test" tags: [] + purge_tags: true register: add_empty - name: Get asg info @@ -138,7 +140,6 @@ propagate_at_launch: yes - snake_case: "simple_snake_case" propagate_at_launch: no - purge_tags: false register: add_result - name: Get asg info @@ -171,7 +172,6 @@ propagate_at_launch: yes - snake_case: "simple_snake_case" propagate_at_launch: no - purge_tags: false register: add_result - name: Get asg info @@ -193,6 +193,7 @@ propagate_at_launch: no - tag_b: 'val_b' propagate_at_launch: yes + purge_tags: true register: add_purge_result - name: Get asg info @@ -258,7 +259,6 @@ propagate_at_launch: no - Title Case: "Hello Cruel World" propagate_at_launch: yes - purge_tags: false register: add_result - name: Get asg info @@ -308,6 +308,7 @@ ec2_asg: name: "{{ resource_prefix }}-asg-tag-test" tags: [] + purge_tags: true register: add_empty - name: Get asg info