template-configuration v1.2.1
CloudFormation + CodePipeline Template Configuration For CLI Tools
Making development closer to production use of CodePipeline
See Limitations section towards the bottom
Supported CLI Tools
aws cloudformationhttps://aws.amazon.com/cli/deploy | create-stack | create-change-set | create-stack-instances | create-stack-set | update-stack | update-stack-instances | update-stack-set
aws serverlessrepo create-cloud-formation-change-sethttps://aws.amazon.com/cli/sam deployhttps://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.htmlrain deployhttps://github.com/aws-cloudformation/rain
Fed up of the following commands all differing in their parameter overrides and tags parameter formats? and them all differing from how CloudFormation Actions in CodePipeline are configured?
Then do one of these:
$ tc aws cloudformation deploy ...
$ tc aws cloudformation create-change-set ...
$ tc sam deploy ...
$ tc rain deploy ...With a template configuration file template-configuration/default.json (see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-cfn-artifacts.html#w2ab1c21c17c15)
{
"Parameters": {
"Key": "Value"
},
"Tags": {
"TagKey": "TagValue"
},
"StackPolicy": {
"Statement": [
{
"Effect": "Allow",
"NotAction": "Update:Delete",
"Principal": "*",
"Resource": "*"
}
]
}
}And do away with your flakey non-production-like deploy scripts, and stop doing these:
$ aws cloudformation deploy \
--parameter-overrides \
Key=Value \
Key2=Value2 \
...$ aws cloudformation create-change-set \
--parameters \
ParameterKey=Key,ParameterValue=Value \
ParameterKey=Key2,ParameterValue=Value2 \
...$ sam deploy \
--parameter-overrides \
ParameterKey=Key,ParameterValue=Value \
ParameterKey=Key2,ParameterValue=Value2 \
...$ rain \
--params \
Key=Value,Key2=Value2Implicit Proxy
Add the following to your shell rc/profile file to replace aws, sam,
and/or rain with implicit tc proxying (e.g. ~/.bashrc, ~/.zshrc, etc)
aws () { template-configuration "$0" "$@" }
sam () { template-configuration "$0" "$@" }
rain () { template-configuration "$0" "$@" }Then tc is implicit and no longer needed
$ aws cloudformation deploy ...
$ aws cloudformation create-change-set ...
$ sam deploy ...
$ rain deploy ...Limitations
- only supports commands without global arguments between them (where they
would otherwise be supported)
- supported
aws cloudformation deploy ... --profile <profile> --region <region> - not-supported
aws --profile <profile> --region <region> cloudformation deploy ...
- supported
- only supports proxying to help commands where help arguments are the last argument e.g.
aws cloudformation deploy help - does not and does not plan to support merging each commands existing parameter arguments with a template configuration file
- add support for
tc --parameters ... [cmd ...]for 1 single way override template configuration file values - test / add support for parameters with quoted values
- support
UsePreviousValue tc help --help -h- support
StackPolicyfor those commands that support it, and maybe do 2nd api call if needed for those where it is not
Arguments
Some arguments can come before the proxied command e.g. tc <here> aws ...
tc initcreate atemplate-configuration/default.jsonfile, with optional additional--configargument--debugechos out the command that is also ran--dryrunonly echo out the command that would otherwise be ran – implies--debug--config <configuration-file>overridetemplate-configuration/default.jsonwith another local file path- e.g.
tc --config template-configuration/test.json sam deploy ...
- e.g.