-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(cli): tags with an equals sign in the value only use the value of the string prior to the equals sign #21003
Comments
Hi Peter, I encountered the same problem while attempting to tag the resources created in the bootstrapping phase of the deployment process, specifically the S3 bucket created by CDK prior to actually deploying the stack(s). Here is a workaround: First, a custom name is used for the bootstrap the bucket. That can be done with the following command:
Now that the bucket has a name, its ARN can be determined. Finally the AWS
We found the most convenient way is to use a JSON file with the following structure:
This approach works for preserving values which contain Have a good day, |
Hi, @peterwoodworth |
When overriding tags from the CLI the tag key-value string is split by an equal sign and the left and right parts are used for key and value respectively. The documentation for the [String.prototype.split()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) states that the second parameter sets a limit of the returned values after execution: > If provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. Any leftover text is not included in the array at all. So basically if we have `foo=bar=test` and we apply a split with a limit of 2 (`"foo=bar=test".split("=", 2)`) we will get the following array `["foo", "bar"]` instead of the expected one`["foo", "bar=test"]`. There has been the same problem with the context values and since it is the same problem the solution is also the same: #5773 With this fix the `context` and `tags` get the same behaviour when parsing the passed values. Closes #21003 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
When overriding tags from the CLI the tag key-value string is split by an equal sign and the left and right parts are used for key and value respectively. The documentation for the [String.prototype.split()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) states that the second parameter sets a limit of the returned values after execution: > If provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array. Any leftover text is not included in the array at all. So basically if we have `foo=bar=test` and we apply a split with a limit of 2 (`"foo=bar=test".split("=", 2)`) we will get the following array `["foo", "bar"]` instead of the expected one`["foo", "bar=test"]`. There has been the same problem with the context values and since it is the same problem the solution is also the same: #5773 With this fix the `context` and `tags` get the same behaviour when parsing the passed values. Closes #21003 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
If you need a tag with a key value pair such as
Key : MyKey
Value : MyValue=Something
The stack will have a key value pair that shows
Key: MyKey
Value: MyValue
Expected Behavior
I would expect the value of the tag to be MyValue=Something
Current Behavior
Doesn't read the full tag value
Reproduction Steps
Try to create a stack with a tag that has an equals sign in the value
Possible Solution
The code which parses tags in the command line will split when it sees an equals sign, and will only use the second split value as the tag value, when it should be everything after the first split
aws-cdk/packages/aws-cdk/lib/settings.ts
Lines 327 to 348 in a7e3eab
Additional Information/Context
No response
CDK CLI Version
.
Framework Version
No response
Node.js Version
.
OS
.
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: