From ca0c14e4549bf02fb22bdebeb5388f4da05580c9 Mon Sep 17 00:00:00 2001 From: PandaWill Date: Fri, 27 Nov 2020 15:45:20 +0000 Subject: [PATCH 1/3] Fix for aws_kms_info with external/custom key store keys --- plugins/modules/aws_kms_info.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/modules/aws_kms_info.py b/plugins/modules/aws_kms_info.py index 160ca5e13c7..235b7bc5b1e 100644 --- a/plugins/modules/aws_kms_info.py +++ b/plugins/modules/aws_kms_info.py @@ -373,7 +373,11 @@ def get_key_details(connection, module, key_id, tokens=None): exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response)) result['aliases'] = aliases.get(result['KeyId'], []) - result['enable_key_rotation'] = get_enable_key_rotation_with_backoff(connection, key_id) + + if result['Origin'] == 'AWS_KMS': + result['enable_key_rotation'] = get_enable_key_rotation_with_backoff(connection, key_id) + else: + result['enable_key_rotation'] = None if module.params.get('pending_deletion'): return camel_dict_to_snake_dict(result) From 38b258416259df0a1c8f249fec7fa127e6688238 Mon Sep 17 00:00:00 2001 From: PandaWill Date: Fri, 27 Nov 2020 23:07:11 +0000 Subject: [PATCH 2/3] Added changelog fragment --- changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml diff --git a/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml b/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml new file mode 100644 index 00000000000..0adbd42ed05 --- /dev/null +++ b/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml @@ -0,0 +1,2 @@ +bugfixes: + - aws_kms_info - fixed incompatibility with external and custom key-store keys. The module was attempting to call `GetKeyRotationStatus`, which raises `UnsupportedOperationException` for these key types (https://github.com/ansible-collections/community.aws/pull/311) \ No newline at end of file From 0f27fe16042c7a3b1f41443f7694e48769b1f6a1 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Sat, 28 Nov 2020 09:54:04 +0100 Subject: [PATCH 3/3] Update changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml --- changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml b/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml index 0adbd42ed05..618023c35ee 100644 --- a/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml +++ b/changelogs/fragments/311-fix-aws_kms_info-external-keys.yaml @@ -1,2 +1,2 @@ bugfixes: - - aws_kms_info - fixed incompatibility with external and custom key-store keys. The module was attempting to call `GetKeyRotationStatus`, which raises `UnsupportedOperationException` for these key types (https://github.com/ansible-collections/community.aws/pull/311) \ No newline at end of file + - aws_kms_info - fixed incompatibility with external and custom key-store keys. The module was attempting to call `GetKeyRotationStatus`, which raises `UnsupportedOperationException` for these key types (https://github.com/ansible-collections/community.aws/pull/311).