Update aws_cloudformation_stack data source with new helper function.

This commit adds support for new helper function which is used to
normalise JSON string.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
Krzysztof Wilczynski 2016-09-14 11:42:13 +01:00
parent e8a7b5d1c6
commit f1d3b21fd2
No known key found for this signature in database
GPG Key ID: B89F6447B63419A6
1 changed files with 10 additions and 4 deletions

View File

@ -18,9 +18,12 @@ func dataSourceAwsCloudFormationStack() *schema.Resource {
Required: true,
},
"template_body": {
Type: schema.TypeString,
Computed: true,
StateFunc: normalizeJson,
Type: schema.TypeString,
Computed: true,
StateFunc: func(v interface{}) string {
json, _ := normalizeJsonString(v)
return json
},
},
"capabilities": {
Type: schema.TypeSet,
@ -103,7 +106,10 @@ func dataSourceAwsCloudFormationStackRead(d *schema.ResourceData, meta interface
return err
}
d.Set("template_body", normalizeJson(*tOut.TemplateBody))
template, _ := normalizeJsonString(*tOut.TemplateBody)
if err := d.Set("template_body", template); err != nil {
return err
}
return nil
}