1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[cloud] Support changeset_name parameter on CloudFormation stack create (#31436)

This commit is contained in:
Samprita Hegde 2017-10-13 01:14:06 +05:30 committed by Ryan Brown
parent bc1e3d22c2
commit 6d16739926

View file

@ -304,7 +304,8 @@ def list_changesets(cfn, stack_name):
def create_changeset(module, stack_params, cfn): def create_changeset(module, stack_params, cfn):
if 'TemplateBody' not in stack_params and 'TemplateURL' not in stack_params: if 'TemplateBody' not in stack_params and 'TemplateURL' not in stack_params:
module.fail_json(msg="Either 'template' or 'template_url' is required.") module.fail_json(msg="Either 'template' or 'template_url' is required.")
if module.params['changeset_name'] is not None:
stack_params['ChangeSetName'] = module.params['changeset_name']
try: try:
changeset_name = build_changeset_name(stack_params) changeset_name = build_changeset_name(stack_params)
stack_params['ChangeSetName'] = changeset_name stack_params['ChangeSetName'] = changeset_name
@ -507,8 +508,6 @@ def main():
if module.params['stack_policy'] is not None: if module.params['stack_policy'] is not None:
stack_params['StackPolicyBody'] = open(module.params['stack_policy'], 'r').read() stack_params['StackPolicyBody'] = open(module.params['stack_policy'], 'r').read()
if module.params['changeset_name'] is not None:
stack_params['ChangeSetName'] = module.params['changeset_name']
template_parameters = module.params['template_parameters'] template_parameters = module.params['template_parameters']
stack_params['Parameters'] = [{'ParameterKey':k, 'ParameterValue':str(v)} for k, v in template_parameters.items()] stack_params['Parameters'] = [{'ParameterKey':k, 'ParameterValue':str(v)} for k, v in template_parameters.items()]