From 403a6a400253ad8bf6a2f6866a9e6903c4bc6ff2 Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Sun, 18 Feb 2018 22:03:20 -0300 Subject: [PATCH] Document YAML and JSON codecs for the file lookup --- CHANGELOG.md | 4 ++++ docs/lookups.rst | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce8d31066..2b1fba2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming/Master + +- Add JSON and YAML codecs to file lookup + ## 1.3.0 (2018-05-03) - Support for provisioning stacks in multiple accounts and regions has been added [GH-553], [GH-551] diff --git a/docs/lookups.rst b/docs/lookups.rst index 55badd53f..8c2327ebb 100644 --- a/docs/lookups.rst +++ b/docs/lookups.rst @@ -246,6 +246,35 @@ Supported codecs: - parameterized-b64 - the same as parameterized, with the results additionally wrapped in { "Fn::Base64": ... } , which is what you actually need for EC2 UserData + - json - decode the file as JSON and return the resulting object + - json-parameterized - Same as ``json``, but applying templating rules from + ``parameterized`` to every object *value*. Note that object *keys* are not + modified. Example (an external PolicyDocument):: + + { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "some:Action" + ], + "Resource": "{{MyResource}}" + } + ] + } + + - yaml - decode the file as YAML and return the resulting object. All strings + are returned as ``unicode`` even in Python 2. + - yaml-parameterized - Same as ``json-parameterized``, but using YAML. Example:: + + Version: 2012-10-17 + Statement + - Effect: Allow + Action: + - "some:Action" + Resource: "{{MyResource}}" + When using parameterized-b64 for UserData, you should use a local_parameter defined as such::