/cloudformable

A grunt-based starting point for static generation of CloudFormation templates

Primary LanguageHTML

Cloudformable

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.

Usage

  1. Install npm (left as an exercise to the reader).
  2. Install grunt globally:
  • npm install -g grunt-cli
  1. Clone this repo:
  • git clone https://github.com/dliggat/cloudformable
  • cd cloudformable
  1. Install the dependencies from this repo's package.json:
  • npm install
  1. Customize to your situation:
  • Update data with static data
  • Add custom code in helpers
  • Add, modify, or delete .hbs files in partials/resources
  • Update outputs.hbs and resources.hbs accordingly
  1. Generate the final CloudFormation artifact(s):
  • grunt render
  1. The results will appear in _output. From here, incorporate into your build system, or use within CloudFormation directly.

Structure

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.