Merge pull request #1435 from civisanalytics/cloudformation_yaml
cloudformation: accept local templates in yaml format
This commit is contained in:
commit
273abeb8ee
1 changed files with 14 additions and 0 deletions
|
@ -81,6 +81,12 @@ options:
|
|||
- Location of file containing the template body. The URL must point to a template (max size 307,200 bytes) located in an S3 bucket in the same region as the stack. This parameter is mutually exclusive with 'template'. Either one of them is required if "state" parameter is "present"
|
||||
required: false
|
||||
version_added: "2.0"
|
||||
template_format:
|
||||
description: For local templates, allows specification of json or yaml format
|
||||
default: json
|
||||
choices: [ json, yaml ]
|
||||
required: false
|
||||
version_added: "2.0"
|
||||
|
||||
author: James S. Martin
|
||||
extends_documentation_fragment: aws
|
||||
|
@ -127,6 +133,7 @@ EXAMPLES = '''
|
|||
|
||||
import json
|
||||
import time
|
||||
import yaml
|
||||
|
||||
try:
|
||||
import boto
|
||||
|
@ -224,6 +231,7 @@ def main():
|
|||
stack_policy=dict(default=None, required=False),
|
||||
disable_rollback=dict(default=False, type='bool'),
|
||||
template_url=dict(default=None, required=False),
|
||||
template_format=dict(default='json', choices=['json', 'yaml'], required=False),
|
||||
tags=dict(default=None)
|
||||
)
|
||||
)
|
||||
|
@ -250,6 +258,12 @@ def main():
|
|||
else:
|
||||
template_body = None
|
||||
|
||||
if module.params['template_format'] == 'yaml':
|
||||
if template_body is None:
|
||||
module.fail_json(msg='yaml format only supported for local templates')
|
||||
else:
|
||||
template_body = json.dumps(yaml.load(template_body), indent=2)
|
||||
|
||||
if module.params['stack_policy'] is not None:
|
||||
stack_policy_body = open(module.params['stack_policy'], 'r').read()
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue