fix(ssm): StringParameter accepts ParameterType.AWS_EC2_IMAGE_ID as type#16884
fix(ssm): StringParameter accepts ParameterType.AWS_EC2_IMAGE_ID as type#16884mergify[bot] merged 8 commits intoaws:masterfrom kaizencc:bug/ssm
Conversation
njlynch
left a comment
There was a problem hiding this comment.
Open to argument about the enum, but I think it's the cleaner experience.
| * | ||
| * @default - 'text' | ||
| */ | ||
| readonly dataType?: string; |
There was a problem hiding this comment.
What do you think about creating a ParameterDataType enum for this property? Just to avoid people having to remember/hard-coded 'aws:ec2:image' in their code.
There was a problem hiding this comment.
enum it is. My original worry was that the docs do not specify that the dataType is exactly text | aws:ec2:image. Theoretically it could accept other data types as well...
But my thoughts are that we are likely covering 99.9% of the use case for dataType with this enum, so I think it is fine.
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…ype (aws#16884) Fixes aws#16806. Now, setting `type: ssm.ParameterType.AWS_EC2_IMAGE_ID` throws an error and instead, you can set `dataType: 'aws:ec2:image'`. Specifically, the `ssm.ParameterType.AWS_EC2_IMAGE_ID` value is used internally (original [PR](aws#4161)) in a few places and really shouldn't be exposed to the customer. But I'm not sure what else we can do, especially since this is a stable module. Original code using `CfnParameter`: ```ts const parameter = ssm.CfnParameter(this, "ImageBuilderAMI", { type: "String", dataType: "aws:ec2:image", name: "/ec2-imagebuilder/latest", description: "Latest AMI Image", value: self.node.try_get_context(env_context)["LinuxAmi"] }); ``` Can now use `StringParameter`: ```ts const parameter = ssm.StringParameter(this, 'ImageBuilderAMI', { dataType: 'aws:ec2:image', parameterName: '/ec2-imagebuilder/latest', description: "Latest AMI Image", stringValue: self.node.try_get_context(env_context)["LinuxAmi"] }); ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes #16806. Now, setting
type: ssm.ParameterType.AWS_EC2_IMAGE_IDthrows an error and instead, you can setdataType: 'aws:ec2:image'. Specifically, thessm.ParameterType.AWS_EC2_IMAGE_IDvalue is used internally (original PR) in a few places and really shouldn't be exposed to the customer. But I'm not sure what else we can do, especially since this is a stable module.Original code using
CfnParameter:Can now use
StringParameter:By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license