aws / aws/aws-cli

Merge cloudformation --cli-input-json parameters and --parameters

Open
#2,429 21 comments 22 reactions 0 assignees View on GitHub
cloudformation feature-request p3
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

Given this cloudformation JSON input file `input.json`:

```json
{
"StackName": "MyStack",
"Parameters": [
{ "ParameterKey": "A", "ParameterValue": "a" },
{ "ParameterKey": "B", "ParameterValue": "b" }
],
// ...
}
```

I would expect this command

```shell
aws cloudformation create-stack --stack-name 'MyStack' \
--template-body "file://$PWD/template.json" \
--cli-input-json "file://$PWD/input.json" \
--parameters 'ParameterKey=B,ParameterValue=B' \
--parameters 'ParameterKey=C,ParameterValue=C'
```

to merge the `--parameters` overriding the `--cli-input-json` `"Parameters"` key to make something like

```json
[
{ "ParameterKey": "A", "ParameterValue": "a" },
{ "ParameterKey": "B", "ParameterValue": "B" },
{ "ParameterKey": "C", "ParameterValue": "C" }
]
```

The use case for this is I have a cli input json stored in source control for a database stack. There are parameters for dns record, db user name, and db password. I dont want to keep the password in source control with the other params, so I want to deploy with the command I specified above and merge `--parameters` overriding `Parameters` in the input json file.

The documentation I was able to find (http://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html) seems to imply this works, but I was not able to get it working:
> --cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.