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
grunt
globally:
npm install -g grunt-cli
- Clone this repo:
git clone https://github.com/dliggat/cloudformable
cd cloudformable
- Install the dependencies from this repo's
package.json
:
npm install
- Customize to your situation:
- Update
data
with static data - Add custom code in
helpers
- Add, modify, or delete
.hbs
files inpartials/resources
- Update
outputs.hbs
andresources.hbs
accordingly
- 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.hbs
The top-level *.hbs
file(s) is eventually rendered as _output/*.template
on grunt render
.