diff --git a/lib/ansible/modules/cloud/amazon/aws_kms.py b/lib/ansible/modules/cloud/amazon/aws_kms.py index 175404c8c6..e464a794a5 100644 --- a/lib/ansible/modules/cloud/amazon/aws_kms.py +++ b/lib/ansible/modules/cloud/amazon/aws_kms.py @@ -666,7 +666,7 @@ def update_key(connection, module, key): def create_key(connection, module): params = dict(BypassPolicyLockoutSafetyCheck=False, - Tags=ansible_dict_to_boto3_tag_list(module.params['tags']), + Tags=ansible_dict_to_boto3_tag_list(module.params['tags'], tag_name_key_name='TagKey', tag_value_key_name='TagValue'), KeyUsage='ENCRYPT_DECRYPT', Origin='AWS_KMS') if module.params.get('description'): diff --git a/test/integration/targets/aws_kms/tasks/main.yml b/test/integration/targets/aws_kms/tasks/main.yml index 40d1129d10..b8b73676a6 100644 --- a/test/integration/targets/aws_kms/tasks/main.yml +++ b/test/integration/targets/aws_kms/tasks/main.yml @@ -17,6 +17,8 @@ aws_secret_key: "{{ aws_secret_key }}" security_token: "{{ security_token }}" alias: "{{ resource_prefix }}-kms" + tags: + Hello: World state: present enabled: yes register: create_kms @@ -25,6 +27,7 @@ assert: that: - create_kms.key_state == "Enabled" + - create_kms.tags['Hello'] == 'World' - name: find facts about the key aws_kms_facts: @@ -92,8 +95,6 @@ alias: "{{ resource_prefix }}-kms" register: new_key - - fail: - - name: set aws environment base fact set_fact: aws_environment_base: @@ -146,7 +147,7 @@ - grant_one.grants|length == 1 - name: Add a second grant - kms: + aws_kms: region: "{{ aws_region }}" aws_access_key: "{{ aws_access_key }}" aws_secret_key: "{{ aws_secret_key }}"