@magicmark/cf-merge

0.0.4 • Public • Published

💥 cf-merge

cf-merge brings import syntax to CloudFormation templates. Split up and modularize your stacks!

Example

Use top-level imports to merge in other templates:

# @import ./networking.yml
# @import ./security.yml

AWSTemplateFormatVersion: 2010-09-09
Parameters:
    - foo
Resources:
    - bar

Use inline imports to merge in sections of other templates:

AWSTemplateFormatVersion: 2010-09-09
Parameters:
    - foo
    # @import ./ec2_instances.yml#Parameters
Resources:
    - bar
    # @import ./ec2_instances.yml#Resources

See the tests to see examples of this in action.

Usage

cf-merge is distributed as a nodejs package. You can install it via npm or yarn:

yarn add @magicmark/cf-merge

You can then call cf-merge in your bash script when calling aws cloudformation deploy:

aws cloudformation deploy \
  --region $REGION \
  --profile $CLI_PROFILE \
  --stack-name $STACK_NAME \
  --template-file "$(yarn cf-merge main.yml --tmpfile)" \

CLI API Docs

cf-merge <file>

Positionals:
  file  path to a CloudFormation template file                          [string]

Options:
  --version      Show version number                                   [boolean]
  --help         Show help                                             [boolean]
  --path, -p     output file path (will print output to stdout if not specified)
                                                                        [string]
  --tmpfile, -t  print template to a tmpfile. prints the filepath to stdout.
                                                      [boolean] [default: false]

Readme

Keywords

none

Package Sidebar

Install

npm i @magicmark/cf-merge

Weekly Downloads

5

Version

0.0.4

License

MIT

Unpacked Size

8.99 kB

Total Files

4

Last publish

Collaborators

  • magicmark