-
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
aws-ssm: StringParameter Doesn't support data_type=ssm.ParameterType.AWS_EC2_IMAGE_ID #16806
Comments
Thanks for reporting this! The only accepted values for The CDK wants you to use an enum aws-cdk/packages/@aws-cdk/aws-ssm/lib/parameter.ts Lines 441 to 448 in f004e1a
|
…ype (#16884) Fixes #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](#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*
|
…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*
What is the problem?
When trying to create a StringParameter of type ssm.ParameterType.AWS_EC2_IMAGE_ID, CDK throws the following error.
1 validation error detected: Value 'AWS::EC2::Image::Id' at 'type' failed to satisfy constraint: Member must satisfy enum value set: [SecureString, StringList, String]. (Service: AmazonSSM; Status Code: 400; Error Code: Validat
ionException; Request ID: 2c97174a-045e-4451-be0a-b61d8f5a2fe8; Proxy: null)
Reproduction Steps
image_parameter = ssm.StringParameter(self, 'ImageBuilderAMI',
type = ssm.ParameterType.AWS_EC2_IMAGE_ID,
parameter_name = '/ec2-imagebuilder/latest',
description = "Latest AMI Image",
string_value = self.node.try_get_context(env_context)["LinuxAmi"]
)
What did you expect to happen?
Since it is StringParameter, there should be an additional value passed in the constructor data_type.
This is a working version using ssm.CfnParameter.
What actually happened?
Stack failed to create.
1 validation error detected: Value 'AWS::EC2::Image::Id' at 'type' failed to satisfy constraint: Member must satisfy enum value set: [SecureString, StringList, String]. (Service: AmazonSSM; Status Code: 400; Error Code: Validat
ionException; Request ID: 2c97174a-045e-4451-be0a-b61d8f5a2fe8; Proxy: null)
CDK CLI Version
1.24.0
Framework Version
No response
Node.js Version
14.16.1
OS
MacOS Big Sur
Language
Python
Language Version
3.9
Other information
No response
The text was updated successfully, but these errors were encountered: