AWS: add capabilities parameter in cloudformation (#53624)

User can now specify capabilities that stack template provides.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/53800/head
Abhijeet Kasurde 6 years ago committed by GitHub
parent edcd921258
commit b8da83cfe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -143,6 +143,13 @@ options:
version_added: "2.8" version_added: "2.8"
type: int type: int
required: False required: False
capabilities:
description:
- Specify capabilites that stack template contains.
- Valid values are CAPABILITY_IAM, CAPABILITY_NAMED_IAM and CAPABILITY_AUTO_EXPAND.
type: list
version_added: "2.8"
default: [ CAPABILITY_IAM, CAPABILITY_NAMED_IAM ]
author: "James S. Martin (@jsmartin)" author: "James S. Martin (@jsmartin)"
extends_documentation_fragment: extends_documentation_fragment:
@ -605,6 +612,7 @@ def main():
backoff_retries=dict(type='int', default=10, required=False), backoff_retries=dict(type='int', default=10, required=False),
backoff_delay=dict(type='int', default=3, required=False), backoff_delay=dict(type='int', default=3, required=False),
backoff_max_delay=dict(type='int', default=30, required=False), backoff_max_delay=dict(type='int', default=30, required=False),
capabilities=dict(type='list', default=['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'])
) )
) )
@ -616,9 +624,19 @@ def main():
if not HAS_BOTO3: if not HAS_BOTO3:
module.fail_json(msg='boto3 and botocore are required for this module') module.fail_json(msg='boto3 and botocore are required for this module')
invalid_capabilities = []
user_capabilities = module.params.get('capabilities')
for user_cap in user_capabilities:
if user_cap not in ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND']:
invalid_capabilities.append(user_cap)
if invalid_capabilities:
module.fail_json(msg="Specified capabilities are invalid : %r,"
" please check documentation for valid capabilities" % invalid_capabilities)
# collect the parameters that are passed to boto3. Keeps us from having so many scalars floating around. # collect the parameters that are passed to boto3. Keeps us from having so many scalars floating around.
stack_params = { stack_params = {
'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], 'Capabilities': user_capabilities,
'ClientRequestToken': to_native(uuid.uuid4()), 'ClientRequestToken': to_native(uuid.uuid4()),
} }
state = module.params['state'] state = module.params['state']

Loading…
Cancel
Save