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

aws_ssm: StringList SSM Parameter cannot contain the ',' character #26944

Closed
jshinevar opened this issue Aug 30, 2023 · 9 comments
Closed

aws_ssm: StringList SSM Parameter cannot contain the ',' character #26944

jshinevar opened this issue Aug 30, 2023 · 9 comments
Labels
@aws-cdk/aws-ssm Related to AWS Systems Manager feature-request A feature should be added or improved. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@jshinevar
Copy link

Describe the bug

When creating a StringList SSM Parameter, it will not allow a list of strings separated by commas. This is definitely allowed because you can manually type in a list inside of SSM in AWS.

Expected Behavior

I would expect the string_list_value parameter to allow a comma in it's contents.

Current Behavior

on cdk synth I get the following error: RuntimeError: Values of a StringList SSM Parameter cannot contain the ',' character. Use a string parameter instead.

Reproduction Steps

create a aws_ssm.StringListParameter and in the string_list_value parameter have a comma in the string

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.93.0

Framework Version

No response

Node.js Version

9.5.1

OS

MacOS and Linux

Language

Python

Language Version

3.9.6

Other information

No response

@jshinevar jshinevar added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ssm Related to AWS Systems Manager label Aug 30, 2023
@peterwoodworth
Copy link
Contributor

According to the API docs, commas are not allowed values. Could you please give an example of the list you are attempting to create and the CDK code that you are doing that with?

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2023
@jshinevar
Copy link
Author

image

@peterwoodworth please see the image above

@peterwoodworth
Copy link
Contributor

Right, just do this

    new ssm.StringListParameter(this, 'stringlistparam', {
      stringListValue: ['secret1', 'secret2', 'secret3']
    })

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Aug 30, 2023
@jshinevar
Copy link
Author

jshinevar commented Aug 30, 2023

The data being provided is being read out of a text file, I mean, I guess I can read it, remove the commas and create an array and then put it back in, but that seems like a lot of unnecessary logic when CDK should be able to just differentiate when presented. My temporary solution is going to be just seeing if a String Parameter works vice a StringList... but it seems to me that if you are having a "StringList" you should either be able to accept an array of strings or a string with the expected delimiter.

@akmalharith
Copy link

stringListValue is expected to be string[]

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringListParameter.html.

@peterwoodworth
Copy link
Contributor

Yes, the high level construct is designed this way. If it creates too much of a hassle for you, you could provide some dummy value to the stringListValue prop, and then use an escape hatch to override the synthesized value property on the defaultChild of the StringListParameter with your comma separated list

@peterwoodworth peterwoodworth added feature-request A feature should be added or improved. and removed bug This issue is a bug. labels Aug 30, 2023
@peterwoodworth
Copy link
Contributor

Closing because this is not a bug - and is not a feature request we would consider

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@pradoz
Copy link

pradoz commented Sep 1, 2024

For anyone who lands here in the future, StringListParameter has been deprecated. I found the easiest here is either

  1. Store the strings with a well-known delimiter and splitting/parsing it based on that delimiter
  2. Passing stringify'd JSON to the parameter if a map is needed, then parsing that value into a JSON structure and performing key lookups on the resulting map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ssm Related to AWS Systems Manager feature-request A feature should be added or improved. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants