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). 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)