Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdk deploy incorrect parsing of --parameters #7246

Closed
mikayzo opened this issue Apr 8, 2020 · 0 comments · Fixed by #7226
Closed

cdk deploy incorrect parsing of --parameters #7246

mikayzo opened this issue Apr 8, 2020 · 0 comments · Fixed by #7226
Assignees
Labels
bug This issue is a bug. in-progress This issue is being actively worked on. p1 package/tools Related to AWS CDK Tools or CLI

Comments

@mikayzo
Copy link

mikayzo commented Apr 8, 2020

When using:

cdk deploy --no-execute --parameters 'aws-stuff:OpsGenieSubscriptionEndpoint=https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey=some-random-key' '*'

I expect CDK to create a Change Set in my stack with parameter: OpsGenieSubscriptionEndpoint and its value: https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey=some-random-key

What I get instead is parameter: OpsGenieSubscriptionEndpoint and its value https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey

I found this issue in the code and here is an example of how it works:

current code:

const parameterMap: { [name: string]: string | undefined } = {};

let parameter = "aws-stuff:OpsGenieSubscriptionEndpoint=https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey=some-random-key";

if (typeof parameter === 'string') {
    const keyValue = (parameter as string).split('=');
    parameterMap[keyValue[0]] = keyValue[1];
    console.log(parameterMap)
}

output:

[LOG]: { "aws-stuff:OpsGenieSubscriptionEndpoint": "https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey" } 

how it should work:

const parameterMap: { [name: string]: string | undefined } = {};

let parameter = "aws-stuff:OpsGenieSubscriptionEndpoint=https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey=some-random-key";

if (typeof parameter === 'string') {
    const keyValue = (parameter as string).split('=');
    parameterMap[keyValue[0]] = keyValue.slice(1).join("=");
    console.log(parameterMap)
}

output:

[LOG]: { "aws-stuff:OpsGenieSubscriptionEndpoint": "https://api.eu.opsgenie.com/v1/json/cloudwatch?apiKey=some-random-key" } 

Reproduction Steps

  1. Pass a parameter which has multiple = symbols when using: cdk deploy --parameters '' command, e.g, cdk deploy --parameters 'parameterKey=parameterValue=partOfValue=anotherPartOfValue'

Error Log

None, I only see incorrect parameter input in AWS.

Environment

  • CLI Version :
$ cdk --version
1.31.0 (build 8f3ac79)
  • Framework Version:
  • OS :
macOS Catalina
version 10.15.4
  • Language :

Other

Suggested fix: #7226


This is 🐛 Bug Report

@mikayzo mikayzo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 8, 2020
@SomayaB SomayaB added in-progress This issue is being actively worked on. package/tools Related to AWS CDK Tools or CLI labels Apr 9, 2020
@shivlaks shivlaks added p1 and removed needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2020
@mergify mergify bot closed this as completed in #7226 Apr 15, 2020
mergify bot pushed a commit that referenced this issue Apr 15, 2020
…7226)

Using `cdk-deploy` with `--parameters` flag loses part of parameter string if it contains more than one `=` symbol

Why?

Because current code splits parameter string on "=" and only adds the 1st element to parameterMap as a value

Fixes #7246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. in-progress This issue is being actively worked on. p1 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants