serverless-plugin-time-substitution
v1.0.6
Published
Serverless plugin to substitute time in compiled cloudformation template
Downloads
420
Maintainers
Readme
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
- Install plugin from npm:
npm install --save-dev serverless-plugin-time-substitution
- Add to the
plugins
section of yourserverless.yml
:
plugins:
- serverless-plugin-time-substitution
- Include placeholders in your CloudFormation templates.
More Info
Heavily influenced by serverless-cloudformation-sub-variables