serverless-plugin-time-substitution

1.0.6 • Public • Published

serverless-plugin-time-substitution

Serverless plugin to substitute time in compiled cloudformation template

Add a time placeholder to your CloudFormation template and the plugin will replace this with the time.

This is especially useful for Api Gateway deployments that are not automatically generated by the serverless framework.

...
Resources:
    ApiGatewayDeployment_##time##:
        Type: AWS::ApiGateway::Deployment
        Properties:
...

You just need to add some placeholders in your CloudFormation template:

  • ##time##: Is substituted by the time in YYYYMMDDhhmmss format (Example: 20190430131815)
  • ##time_long##: Is substituted by the time in a longer format (Example: Tue Apr 30 2019 13:18:15 GMT-0600 (GMT-06:00))

The plugin is run after the serverless package command is executed.

The placeholders can be configured using the custom section in the serverless.yml file:

...
custom:
    timeSubstitution:
        patternShort: &&time&&
        patternLong: &&long_time&&
...

Getting Started

  1. Install plugin from npm:
npm install --save-dev serverless-plugin-time-substitution
  1. Add to the plugins section of your serverless.yml:
plugins:
  - serverless-plugin-time-substitution
  1. Include placeholders in your CloudFormation templates.

More Info

Heavily influenced by serverless-cloudformation-sub-variables

Package Sidebar

Install

npm i serverless-plugin-time-substitution

Weekly Downloads

9

Version

1.0.6

License

MIT

Unpacked Size

12.4 kB

Total Files

5

Last publish

Collaborators

  • manemarron