You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AWS::Cloud9::EnvironmentEC2 resource type has an ImageId property that is unique from other ImageId properties in AWS in that it only allows AMI aliases or AWS Systems Manager paths (see CloudFormation docs).
The validation performed by cfn-lint lumps EnvironmentEC2 validation with the more standard uses of ImageId and requires a value that is either an AWS::EC2::Image::Id or AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> (per this).
So the issue here is two-fold:
Current validation does not support one of the valid property values (AMI alias), and
Current validation allows an unsupported property value (image ID)
While some of these are only warnings, you do get an error when trying to use an AMI alias for the ImageId property. Here is the output run against the included reproduction template.
test/cloud9.yaml:5:5:5:9:W2506:'String' is not one of ['AWS::EC2::Image::Id', 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>']
test/cloud9.yaml:21:7:21:14:W1030:{'Ref': 'AMIAlias'} is not a 'AWS::EC2::Image.Id' when 'Ref' is resolved
test/cloud9.yaml:39:7:39:14:E1152:'amazonlinux-2023-x86_64' is not a 'AWS::EC2::Image.Id'
Expected behavior
Linting of a resource of type AWS::Cloud9::EnvironmentEC2 using an AMI alias for the ImageId property should succeed. Validation for this resource property requires custom logic.
Reproduction template
AWSTemplateFormatVersion: 2010-09-09
Description: Test linting of Cloud9 resources
Parameters:
AMIAlias:
Type: String
Description: AMI alias
Default: amazonlinux-2023-x86_64
SSMPath:
Type: AWS::SSM::Parameter::Name
Description: AWS Systems Manager path
Default: /aws/service/cloud9/amis/amazonlinux-2023-x86_64
ImageId:
Type: AWS::SSM::Parameter::ValueAWS::EC2::Image::Id
Description: Image ID
Default: resolve:ssm:/aws/service/cloud9/amis/amazonlinux-2023-x86_64
CloudFormation Lint Version
1.12.4
What operating system are you using?
Amazon Linux 2023
Describe the bug
The
AWS::Cloud9::EnvironmentEC2
resource type has anImageId
property that is unique from other ImageId properties in AWS in that it only allows AMI aliases or AWS Systems Manager paths (see CloudFormation docs).The validation performed by cfn-lint lumps EnvironmentEC2 validation with the more standard uses of ImageId and requires a value that is either an
AWS::EC2::Image::Id
orAWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
(per this).So the issue here is two-fold:
While some of these are only warnings, you do get an error when trying to use an AMI alias for the
ImageId
property. Here is the output run against the included reproduction template.Expected behavior
Linting of a resource of type
AWS::Cloud9::EnvironmentEC2
using an AMI alias for theImageId
property should succeed. Validation for this resource property requires custom logic.Reproduction template
AWSTemplateFormatVersion: 2010-09-09
Description: Test linting of Cloud9 resources
Parameters:
AMIAlias:
Type: String
Description: AMI alias
Default: amazonlinux-2023-x86_64
SSMPath:
Type: AWS::SSM::Parameter::Name
Description: AWS Systems Manager path
Default: /aws/service/cloud9/amis/amazonlinux-2023-x86_64
ImageId:
Type: AWS::SSM::Parameter::ValueAWS::EC2::Image::Id
Description: Image ID
Default: resolve:ssm:/aws/service/cloud9/amis/amazonlinux-2023-x86_64
Resources:
Cloud9EnvironmentAlias:
Type: AWS::Cloud9::EnvironmentEC2
Properties:
ImageId: !Ref AMIAlias
InstanceType: "t2.micro"
Cloud9EnvironmentSSMParam:
Type: AWS::Cloud9::EnvironmentEC2
Properties:
ImageId: !Sub "resolve:ssm:${SSMPath}"
InstanceType: "t2.micro"
Cloud9EnvironmentImageId:
Type: AWS::Cloud9::EnvironmentEC2
Properties:
ImageId: !Ref ImageId
InstanceType: "t2.micro"
Cloud9EnvironmentAliasNoParameter:
Type: AWS::Cloud9::EnvironmentEC2
Properties:
ImageId: amazonlinux-2023-x86_64
InstanceType: "t2.micro"
The text was updated successfully, but these errors were encountered: