aws_kms tags fix (#53088)

* Fix TagName and TagValue in aws_kms

Fixes #53061

* Improve test suite to check for tags

Also fixed some obvious failures, need to run the test suite from time
to time!
This commit is contained in:
Will Thames 2019-03-01 04:54:18 +10:00 committed by Sloane Hertel
parent 5d8f307116
commit 91eee48f1b
2 changed files with 5 additions and 4 deletions

View file

@ -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'):

View file

@ -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 }}"