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

pull/31668/head
Samprita Hegde 7 years ago committed by Ryan Brown
parent bc1e3d22c2
commit 6d16739926

@ -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()]

Loading…
Cancel
Save