forked from cloudtools/stacker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jinja2 template parsing (cloudtools#701)
* add jinja2 template parsing * fix use with non-blueprint variables and lookups
- Loading branch information
1 parent
afc5e99
commit a1ed87a
Showing
7 changed files
with
132 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ Contents: | |
lookups | ||
commands | ||
blueprints | ||
templates | ||
API Docs <api/modules> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
========== | ||
Templates | ||
========== | ||
|
||
CloudFormation templates can be provided via python Blueprints_ or JSON/YAML. | ||
JSON/YAML templates are specified for stacks via the ``template_path`` config | ||
option (see `Stacks <config.html#stacks>`_). | ||
|
||
Jinja2 Templating | ||
================= | ||
|
||
Templates with a ``.j2`` extension will be parsed using `Jinja2 | ||
<http://jinja.pocoo.org/>`_. The stacker ``context`` and ``mappings`` objects | ||
and stack ``variables`` objects are available for use in the template: | ||
|
||
.. code-block:: yaml | ||
Description: TestTemplate | ||
Resources: | ||
Bucket: | ||
Type: AWS::S3::Bucket | ||
Properties: | ||
BucketName: {{ context.environment.foo }}-{{ variables.myparamname }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "TestTemplate", | ||
"Parameters": { | ||
"Param1": { | ||
"Type": "String" | ||
}, | ||
"Param2": { | ||
"Default": "default", | ||
"Type": "CommaDelimitedList" | ||
} | ||
}, | ||
"Resources": { | ||
"Dummy": { | ||
"Type": "AWS::CloudFormation::WaitConditionHandle" | ||
} | ||
}, | ||
"Outputs": { | ||
"DummyId": { | ||
"Value": "dummy-{{ context.environment.foo }}-{{ variables.Param1 }}-{{ variables.bar }}-1234" | ||
} | ||
} | ||
} |