@u-minor/cftemplate
v1.1.1
Published
AWS CloudFormation YAML template generator
Downloads
225
Readme
cftemplate
AWS CloudFormation YAML template generator.
Write separated YAMLs, build them into one CF template!
Installation
Global install
$ npm install @u-minor/cftemplate -g
or install and add to current package.
$ npm install @u-minor/cftemplate --save-dev
Quick start
Make separated YAMLs by using json-refs, and put them info your source directory.
Then, build template like below.
$ cftemplate srcdir > template.yml
Command reference
Usage: cftemplate [options] <dir>
Options:
--version Show version number [boolean]
-e, --entry entry point file name [string] [default: "index.yml"]
-o, --output output file name [string]
--help, -h Show help [boolean]
Writing templates
Make index.yml
(default entry point) like below.
If you want to change it, use
--entry
option.
You can use $ref
to refer another template. (See json-refs for more information)
AWSTemplateFormatVersion: '2010-09-09'
Description: Your project template
Mappings:
$ref: mappings.yml
Outputs:
$ref: outputs.yml
Parameters:
$ref: parameters.yml
Resources:
$ref: .resources.yml
If the template name starts with .
(like .resources.yml
), cftemplate try to merge all templates under the same directory (like resources
).
So you can create yaml files separately for each AWS resource type like resources/CloudFront.yml
, resources/S3.yml
, etc.
Directory tree example:
cf/
├── index.yml
├── mappings.yml
├── outputs.yml
├── parameters.yml
└── resources/
├── CloudFront.yml
├── Lambda.yml
└── S3.yml