aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.48k stars 4.11k forks source link

cloudformation deploy references incorrect format for CodePipeline style parameters #6907

Open corey-cole opened 2 years ago

corey-cole commented 2 years ago

Describe the bug

The documentation for the cloudformation deploy subcommand references invalid JSON when describing the CodePipeline style overrides. At present, the docs reference this JSON construct:

[
    "Parameters": {
        "Key1": "Value1",
        "Key2": "Value2"
    }
]

This is not valid JSON, as the root element is an array. The correct construct for this (validated with a minimal log group template) is:

{
    "Parameters": {
        "Key1": "Value1",
        "Key2": "Value2"
    }
}

Expected Behavior

I expected that following the provided documentation would result in a CloudFormation stack being deployed.

Current Behavior

Passing parameters as described in the docs results in an immediate error

Reproduction Steps

Template:

AWSTemplateFormatVersion: "2010-09-09"

Description: Simple template

Parameters:
  pGroupName:
    Type: String

Resources:
  rLogGroup:
    Type:  AWS::Logs::LogGroup
    Properties:
        LogGroupName: !Ref pGroupName

Parameters (per docs):

[
    "Parameters": {
        "pGroupName": "InnocuousLogGroup"
    }
]

Results:

aws cloudformation deploy --stack-name cp-format-validation --template-file mintemplate.yaml --parameter-overrides file://parameters-fixed.json

Expecting property name enclosed in double quotes: line 4 column 5 (char 69)

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.6.0 Python/3.9.12 Darwin/20.6.0 source/arm64 prompt/off

Environment details (OS name and version, etc.)

macOS 11.6.5

corey-cole commented 2 years ago

Sorry, wrong command in the repro. It's

aws cloudformation deploy --stack-name cp-format-validation --template-file mintemplate.yaml --parameter-overrides file://parameters.json

Expecting ',' delimiter: line 2 column 17 (char 18)
tim-finnigan commented 2 years ago

Hi @corey-cole, thanks for reaching out. It looks like you’re referring to this documentation page: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/deploy/index.html

It does appear that the CodePipeline format at the bottom has invalid JSON as you mentioned. Have you tried using one of the alternative formats described above that?

corey-cole commented 2 years ago

@tim-finnigan Yes, I was able to use another format as-is.