cultureamp / cfparams

Wrangle parameters for AWS CloudFormation
MIT License
0 stars 0 forks source link

Handle template "Default" value #3

Closed vgunawan closed 6 years ago

vgunawan commented 6 years ago

Currently cfparams will add UserPreviousValue field when parameter is not given in parameters file. Like so:

  {
    "ParameterKey": "ImageTag",
    "UsePreviousValue": true
  },

This is useful during update-stack, however during create-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.

pda commented 6 years ago

Got that covered, I believe, with --accept-defaults and --no-previous. From one of the use-cases in the README.md:


Creating ECS service CloudFormation stack

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
)"

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"