Skip to content

Commit

Permalink
bugfix/#1 - failed when using aws default key_id aws/ssm
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Wang committed Apr 19, 2017
1 parent 2239454 commit e5e91f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
30 changes: 8 additions & 22 deletions library/ssm_parameter_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
- Boolean
required: false
default: True
region:
description:
- region.
required: false
author: Bill Wang ([email protected])
extends_documentation_fragment: aws
requirements: [ botocore, boto3 ]
Expand Down Expand Up @@ -108,34 +112,15 @@
description: Add one or more paramaters to the system.
returned: success
type: dictionary
get_parameter:
description: Get details of a parameter.
returned: success
type: dictionary
contains:
name:
description: The name of the parameter.
returned: success
type: string
sample: "Hello"
type:
description: The type of parameter. Valid values include [ String, StringList, SecureString ]
returned: success
type: string
sample: "String"
value:
description: The parameter value.
returned: success
type: string
sample: "World"
delete_parameter:
description: Delete a parameter from the system.
returned: success
type: dictionary
'''

from ansible.module_utils.ec2 import HAS_BOTO3
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import HAS_BOTO3, camel_dict_to_snake_dict
from ansible.module_utils.ec2 import boto3_conn, ec2_argument_spec, get_aws_connection_info

try:
Expand Down Expand Up @@ -223,8 +208,9 @@ def main():
state=dict(default='present', choices=['present', 'absent']),
string_type=dict(default='String', choices=['String', 'StringList', 'SecureString']),
decryption=dict(default=True, type='bool'),
key_id=dict(default='aws/ssm'),
key_id=dict(default="alias/aws/ssm"),
overwrite=dict(default=True, type='bool'),
region=dict(required=False),
)
)

Expand Down
8 changes: 8 additions & 0 deletions test/roles/test/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
name: "notkey"
state: absent

- name: Create or update secure key/value pair in nominated region
ssm_parameter_store:
name: "Hello"
description: "This is your first key"
region: us-east-1
string_type: "SecureString"
value: "World"

- name: Create or update secure key/value pair with nominated kms key
ssm_parameter_store:
name: "Hello"
Expand Down

0 comments on commit e5e91f0

Please sign in to comment.