This repository is a starting point for static generation of CloudFormation templates using grunt, assemble, and handlebars. See my blog post for more details on the motivation behind this project.
- Install
npm(left as an exercise to the reader). - Install
gruntglobally:
npm install -g grunt-cli
- Clone this repo:
git clone https://github.com/dliggat/cloudformablecd cloudformable
- Install the dependencies from this repo's
package.json:
npm install
- Customize to your situation:
- Update
datawith static data - Add custom code in
helpers - Add, modify, or delete
.hbsfiles inpartials/resources - Update
outputs.hbsandresources.hbsaccordingly
- Generate the final CloudFormation artifact(s):
grunt render
- The results will appear in
_output. From here, incorporate into your build system, or use within CloudFormation directly.
The project structure is a straightfoward assemble static site:
$ tree
βββ Gruntfile.js
βββ README.md
βββ _output
βΒ Β βββ cloudformation-stack.template
βββ cloudformation-stack.hbs
βββ data
βΒ Β βββ about.yml
βββ helpers
βΒ Β βββ git.js
βββ package.json
βββ partials
βββ outputs.hbs
βββ parameters.hbs
βββ resources
βΒ Β βββ lambda-execution-policy.hbs
βΒ Β βββ lambda-execution-role.hbs
βΒ Β βββ lambda-function.hbs
βΒ Β βββ lambda-permission.hbs
βΒ Β βββ s3-bucket-policy.hbs
βΒ Β βββ s3-bucket.hbs
βββ resources.hbsThe top-level *.hbs file(s) is eventually rendered as _output/*.template on grunt render.