New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@my-ideas/cftpl

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@my-ideas/cftpl

Add Mustache templating to AWS CLoudFormation

latest
Source
npmnpm
Version
0.1.16
Version published
Maintainers
2
Created
Source

Build Status

What

cftpl is a commandline utility to add a template engine (Mustache) to AWS CloudFormation

Usage

  • Install: npm install -g @my-ideas/cftpl
  • Execution: cftpl <create|changeset> <template> [--stage <stage>] [--profile <profile>]

Action create perform an upsert of the stack (create if doesn't exist, otherwise update). changeset create a ChangeSet with the given template

  • --profile ,profile>: the AWS profile to use to call CloudFormation (this is the only supported credential settings)
  • --dry-run: if you specify this parameter, CloudFormation will not be called
  • --stage <stage>: Add a variable stages: [{name: <stage>}] to the template metadata - this is usefull to create separate stack with the same template (see the examples in /test)

How to write a template

The templating engine is Mustache, refer to Mustache' suser manual.

  • Check test/templates/simple-sns.yaml for a fully documented how-to write a template
  • Check test/gtemplates/test-api-gateway/stack.tpl to see how to load external files in the template

For large templates it is possible to upload the stack generated to S3 by adding the property Metadata.aws.template.__use_s3=bucket . See test/templates/simple-sns-s3-live.yaml

Custom functions

The following functions can be used inside a template:

  • {{funcTime}}: returns the value of new Date().getTime() - @see simple-sns-function.yaml
  • {{#jsonize}}a.key{{/jsonize}}: Return the json representation of the given key - @see test-simple-functions.json
  • {{#jsonizeEscapeQuotes}}a.key{{/jsonizeEscapeQuotes}},: serialize object a.key in JSON and escape all the quotes (which means, convert the object in a string that you can include in other strings. @see /test/templates/test-api-gateway/stack-functions.tpl)

Notes:

  • The name of the stack is in the template metadata

How to count for difference in a ChangeSet

BUG: If there are no changes, aws returns an error! cftpl changeset test/templates/simple-sns.yaml --profile porketta --stage gamma | tail -n +4 | jq '.Changes | length'

FAQs

Package last updated on 25 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts