From cb1b09aac2c0405a19f3a7b0e6c86b4985e44349 Mon Sep 17 00:00:00 2001 From: Adrian Plummer <50164464+aplummerunsw@users.noreply.github.com> Date: Tue, 1 Dec 2020 19:57:59 +1100 Subject: [PATCH 1/2] Use 'fail_json_aws' in the tags_need_modify check In reference to issue #210 ec2_group: error returned does not return AWS insufficient permissions error when adding tags --- plugins/modules/ec2_group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/ec2_group.py b/plugins/modules/ec2_group.py index ae3be9311de..b51a91a0c9f 100644 --- a/plugins/modules/ec2_group.py +++ b/plugins/modules/ec2_group.py @@ -899,7 +899,7 @@ def update_tags(client, module, group_id, current_tags, tags, purge_tags): try: client.create_tags(Resources=[group_id], Tags=ansible_dict_to_boto3_tag_list(tags_need_modify)) except (BotoCoreError, ClientError) as e: - module.fail_json(e, msg="Unable to add tags {0}".format(tags_need_modify)) + module.fail_json_aws(e, msg="Unable to add tags {0}".format(tags_need_modify)) return bool(tags_need_modify or tags_to_delete) From 1e9e6168434be1f24182e9b379101e2d0abeeb12 Mon Sep 17 00:00:00 2001 From: Adrian Plummer <50164464+aplummerunsw@users.noreply.github.com> Date: Tue, 1 Dec 2020 22:39:10 +1100 Subject: [PATCH 2/2] Added changelog fragment for PR #211 --- .../211-fix-error-handling-during-tagging-failure.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/211-fix-error-handling-during-tagging-failure.yaml diff --git a/changelogs/fragments/211-fix-error-handling-during-tagging-failure.yaml b/changelogs/fragments/211-fix-error-handling-during-tagging-failure.yaml new file mode 100644 index 00000000000..5475ef21726 --- /dev/null +++ b/changelogs/fragments/211-fix-error-handling-during-tagging-failure.yaml @@ -0,0 +1,2 @@ +bugfixes: +- ec2_group - Fixes error handling during tagging failures (https://github.com/ansible-collections/amazon.aws/issues/210).