Closed vgunawan closed 6 years ago
Got that covered, I believe, with --accept-defaults
and --no-previous
. From one of the use-cases in the README.md:
Launching the CloudFormation stack for the first time. Accept some defaults from the template, specify all other parameters.
params="$(
cfparams --template=cfn.yaml --accept-defaults --no-previous \
Recipient=world ImageTag=v1 Cluster=nanoservices
)"
--template
loads supported Parameters from a CloudFormation template.--accept-defaults
omits keys that have a default in the CloudFormation template.--no-previous
means fail if a key has no default in the template and isn't specified on the command line. Without this option, those keys will be auto-filled as "UsePreviousValue": true
.Resulting JSON:
[
{"ParameterKey": "Recipient", "ParameterValue": "world"},
{"ParameterKey": "ImageTag", "ParameterValue": "v1"},
{"ParameterKey": "Cluster", "ParameterValue": "nanoservices"}
]
aws cloudformation create-stack \
--stack-name=greeting \
--template-body=file://cfn.yaml \
--parameters="$params"
Currently cfparams will add
UserPreviousValue
field when parameter is not given in parameters file. Like so:This is useful during
update-stack
, however duringcreate-stack
the default values are often needed to create stack.I guess providing switch to do this would be handy such as
--use-template-defaults
.