diff --git a/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py b/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py index 6c52553da..a589f98aa 100644 --- a/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py +++ b/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py @@ -24,21 +24,21 @@ class VpcConfig(BaseModel): # Optional list of security group IDs - supports intrinsic functions for dynamic references - SecurityGroupIds: Optional[List[SamIntrinsicable[str]]] = vpcconfig("SecurityGroupIds") + SecurityGroupIds: Optional[SamIntrinsicable[List[SamIntrinsicable[str]]]] = vpcconfig("SecurityGroupIds") # Required list of subnet IDs - supports intrinsic functions for dynamic VPC configuration - SubnetIds: List[SamIntrinsicable[str]] = vpcconfig("SubnetIds") + SubnetIds: SamIntrinsicable[List[SamIntrinsicable[str]]] = vpcconfig("SubnetIds") class InstanceRequirements(BaseModel): # Optional list of CPU architectures - maps to CFN InstanceRequirements.Architecture - # Uses List[SamIntrinsicable[str]] to support intrinsic functions like !Ref for dynamic architecture values - Architectures: Optional[List[SamIntrinsicable[str]]] = instancerequirements("Architectures") + # Uses SamIntrinsicable[List[SamIntrinsicable[str]]] to support intrinsic functions like !Ref for both list and list item + Architectures: Optional[SamIntrinsicable[List[SamIntrinsicable[str]]]] = instancerequirements("Architectures") # Optional list of allowed EC2 instance types - maps to CFN InstanceRequirements.AllowedInstanceTypes - # Uses List[SamIntrinsicable[str]] to support intrinsic functions like !Ref for dynamic instance types - AllowedTypes: Optional[List[SamIntrinsicable[str]]] = instancerequirements("AllowedTypes") + # Uses SamIntrinsicable[List[SamIntrinsicable[str]]] to support intrinsic functions like !Ref for both list and list item + AllowedTypes: Optional[SamIntrinsicable[List[SamIntrinsicable[str]]]] = instancerequirements("AllowedTypes") # Optional list of excluded EC2 instance types - maps to CFN InstanceRequirements.ExcludedInstanceTypes - # Uses List[SamIntrinsicable[str]] to support intrinsic functions like !Ref for dynamic instance types - ExcludedTypes: Optional[List[SamIntrinsicable[str]]] = instancerequirements("ExcludedTypes") + # Uses SamIntrinsicable[List[SamIntrinsicable[str]]] to support intrinsic functions like !Ref for both list and list item + ExcludedTypes: Optional[SamIntrinsicable[List[SamIntrinsicable[str]]]] = instancerequirements("ExcludedTypes") class ScalingConfig(BaseModel): diff --git a/samtranslator/schema/schema.json b/samtranslator/schema/schema.json index 691b581d0..58994fd23 100644 --- a/samtranslator/schema/schema.json +++ b/samtranslator/schema/schema.json @@ -275088,49 +275088,70 @@ "additionalProperties": false, "properties": { "AllowedTypes": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "The allowed instance types.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`AllowedInstanceTypes`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-allowedinstancetypes) property of the `AWS::Lambda::CapacityProvider` `InstanceRequirements` data type.", - "title": "AllowedTypes", - "type": "array" + "title": "AllowedTypes" }, "Architectures": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "The CPU architecture for the instances.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`Architecture`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-architecture) property of the `AWS::Lambda::CapacityProvider` `InstanceRequirements` data type.", - "title": "Architectures", - "type": "array" + "title": "Architectures" }, "ExcludedTypes": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "The excluded instance types.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`ExcludedInstanceTypes`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-excludedinstancetypes) property of the `AWS::Lambda::CapacityProvider` `InstanceRequirements` data type.", - "title": "ExcludedTypes", - "type": "array" + "title": "ExcludedTypes" } }, "title": "InstanceRequirements", @@ -277136,34 +277157,48 @@ "additionalProperties": false, "properties": { "SecurityGroupIds": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "A list of VPC security group IDs.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`SecurityGroupIds`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-vpcconfig.html#cfn-lambda-capacityprovider-vpcconfig-securitygroupids) property of the `AWS::Lambda::CapacityProvider` `VpcConfig` data type.", - "title": "SecurityGroupIds", - "type": "array" + "title": "SecurityGroupIds" }, "SubnetIds": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "A list of VPC subnet IDs.\n*Type*: List of String\n*Required*: Yes\n*AWS CloudFormation compatibility*: This property is passed directly to the [`SubnetIds`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-vpcconfig.html#cfn-lambda-capacityprovider-vpcconfig-subnetids) property of the `AWS::Lambda::CapacityProvider` `VpcConfig` data type.", - "title": "SubnetIds", - "type": "array" + "title": "SubnetIds" } }, "required": [ diff --git a/schema_source/sam.schema.json b/schema_source/sam.schema.json index 5e75cf527..49d183d0b 100644 --- a/schema_source/sam.schema.json +++ b/schema_source/sam.schema.json @@ -1686,49 +1686,70 @@ "additionalProperties": false, "properties": { "AllowedTypes": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "The allowed instance types.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`AllowedInstanceTypes`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-allowedinstancetypes) property of the `AWS::Lambda::CapacityProvider` `InstanceRequirements` data type.", - "title": "AllowedTypes", - "type": "array" + "title": "AllowedTypes" }, "Architectures": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "The CPU architecture for the instances.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`Architecture`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-architecture) property of the `AWS::Lambda::CapacityProvider` `InstanceRequirements` data type.", - "title": "Architectures", - "type": "array" + "title": "Architectures" }, "ExcludedTypes": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "The excluded instance types.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`ExcludedInstanceTypes`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-excludedinstancetypes) property of the `AWS::Lambda::CapacityProvider` `InstanceRequirements` data type.", - "title": "ExcludedTypes", - "type": "array" + "title": "ExcludedTypes" } }, "title": "InstanceRequirements", @@ -3649,34 +3670,48 @@ "additionalProperties": false, "properties": { "SecurityGroupIds": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "A list of VPC security group IDs.\n*Type*: List of String\n*Required*: No\n*AWS CloudFormation compatibility*: This property is passed directly to the [`SecurityGroupIds`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-vpcconfig.html#cfn-lambda-capacityprovider-vpcconfig-securitygroupids) property of the `AWS::Lambda::CapacityProvider` `VpcConfig` data type.", - "title": "SecurityGroupIds", - "type": "array" + "title": "SecurityGroupIds" }, "SubnetIds": { - "items": { - "anyOf": [ - { - "type": "string" + "anyOf": [ + { + "type": "object" + }, + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] }, - { - "type": "object" - } - ] - }, + "type": "array" + } + ], "markdownDescription": "A list of VPC subnet IDs.\n*Type*: List of String\n*Required*: Yes\n*AWS CloudFormation compatibility*: This property is passed directly to the [`SubnetIds`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-vpcconfig.html#cfn-lambda-capacityprovider-vpcconfig-subnetids) property of the `AWS::Lambda::CapacityProvider` `VpcConfig` data type.", - "title": "SubnetIds", - "type": "array" + "title": "SubnetIds" } }, "required": [ diff --git a/tests/translator/input/capacity_provider_with_intrinsics.yaml b/tests/translator/input/capacity_provider_with_intrinsics.yaml index f2e483c04..5b4f390bc 100644 --- a/tests/translator/input/capacity_provider_with_intrinsics.yaml +++ b/tests/translator/input/capacity_provider_with_intrinsics.yaml @@ -9,11 +9,11 @@ Parameters: SecurityGroupId: Type: String - Default: sg-12345678 + Default: sg-0a1e1457229da0f74 SubnetId: Type: String - Default: subnet-12345678 + Default: subnet-01e6344879fd06036 Architecture: Type: String @@ -23,9 +23,21 @@ Parameters: Type: String Default: c5.xlarge - ExcludedInstanceType: - Type: String - Default: t2.micro + ExcludedInstanceTypeList: + Type: List + Default: t2.micro,c5.xlarge + + SecurityGroupIdList: + Type: List + Default: sg-0a1e1457229da0f74,sg-3b1f1457229da0f92 + + SubnetIdList: + Type: List + Default: subnet-01e6344879fd06036,subnet-0136378879fd07039 + + ArchitecturesList: + Type: List + Default: x86_64 MaxVCpuCount: Type: Number @@ -62,6 +74,21 @@ Resources: AllowedTypes: - !Ref AllowedInstanceType - !Join [., [c5, 2xlarge]] + - c5.large + ScalingConfig: + MaxVCpuCount: !Ref MaxVCpuCount + AverageCPUUtilization: !Ref TargetCPU + KmsKeyArn: !Ref KmsKeyArn + + IntrinsicCapacityProviderTwo: + Type: AWS::Serverless::CapacityProvider + Properties: + VpcConfig: + SecurityGroupIds: !Ref SecurityGroupIdList + SubnetIds: !Ref SubnetIdList + InstanceRequirements: + Architectures: !Ref ArchitecturesList + ExcludedTypes: !Ref ExcludedInstanceTypeList ScalingConfig: MaxVCpuCount: !Ref MaxVCpuCount AverageCPUUtilization: !Ref TargetCPU diff --git a/tests/translator/output/aws-cn/capacity_provider_with_intrinsics.json b/tests/translator/output/aws-cn/capacity_provider_with_intrinsics.json index 3fbaf161c..64f2fa6c1 100644 --- a/tests/translator/output/aws-cn/capacity_provider_with_intrinsics.json +++ b/tests/translator/output/aws-cn/capacity_provider_with_intrinsics.json @@ -10,13 +10,17 @@ "Default": "arm64", "Type": "String" }, + "ArchitecturesList": { + "Default": "x86_64", + "Type": "List" + }, "CapacityProviderName": { "Default": "intrinsic-capacity-provider", "Type": "String" }, - "ExcludedInstanceType": { - "Default": "t2.micro", - "Type": "String" + "ExcludedInstanceTypeList": { + "Default": "t2.micro,c5.xlarge", + "Type": "List" }, "KmsKeyArn": { "Default": "arn:aws:kms:us-east-1:123456789012:key/abcd1234-ef56-gh78-ij90-klmnopqrstuv", @@ -27,13 +31,21 @@ "Type": "Number" }, "SecurityGroupId": { - "Default": "sg-12345678", + "Default": "sg-0a1e1457229da0f74", "Type": "String" }, + "SecurityGroupIdList": { + "Default": "sg-0a1e1457229da0f74,sg-3b1f1457229da0f92", + "Type": "List" + }, "SubnetId": { - "Default": "subnet-12345678", + "Default": "subnet-01e6344879fd06036", "Type": "String" }, + "SubnetIdList": { + "Default": "subnet-01e6344879fd06036,subnet-0136378879fd07039", + "Type": "List" + }, "TargetCPU": { "Default": 75.0, "Type": "Number" @@ -76,7 +88,8 @@ "2xlarge" ] ] - } + }, + "c5.large" ], "Architectures": [ { @@ -157,6 +170,88 @@ ] }, "Type": "AWS::IAM::Role" + }, + "IntrinsicCapacityProviderTwo": { + "Properties": { + "CapacityProviderScalingConfig": { + "MaxVCpuCount": { + "Ref": "MaxVCpuCount" + }, + "ScalingMode": "Manual", + "ScalingPolicies": [ + { + "PredefinedMetricType": "LambdaCapacityProviderAverageCPUUtilization", + "TargetValue": { + "Ref": "TargetCPU" + } + } + ] + }, + "InstanceRequirements": { + "Architectures": { + "Ref": "ArchitecturesList" + }, + "ExcludedInstanceTypes": { + "Ref": "ExcludedInstanceTypeList" + } + }, + "KmsKeyArn": { + "Ref": "KmsKeyArn" + }, + "PermissionsConfig": { + "CapacityProviderOperatorRoleArn": { + "Fn::GetAtt": [ + "IntrinsicCapacityProviderTwoOperatorRole", + "Arn" + ] + } + }, + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ], + "VpcConfig": { + "SecurityGroupIds": { + "Ref": "SecurityGroupIdList" + }, + "SubnetIds": { + "Ref": "SubnetIdList" + } + } + }, + "Type": "AWS::Lambda::CapacityProvider" + }, + "IntrinsicCapacityProviderTwoOperatorRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws-cn:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" } } } diff --git a/tests/translator/output/aws-us-gov/capacity_provider_with_intrinsics.json b/tests/translator/output/aws-us-gov/capacity_provider_with_intrinsics.json index 4ceae3612..96c8ee3b8 100644 --- a/tests/translator/output/aws-us-gov/capacity_provider_with_intrinsics.json +++ b/tests/translator/output/aws-us-gov/capacity_provider_with_intrinsics.json @@ -10,13 +10,17 @@ "Default": "arm64", "Type": "String" }, + "ArchitecturesList": { + "Default": "x86_64", + "Type": "List" + }, "CapacityProviderName": { "Default": "intrinsic-capacity-provider", "Type": "String" }, - "ExcludedInstanceType": { - "Default": "t2.micro", - "Type": "String" + "ExcludedInstanceTypeList": { + "Default": "t2.micro,c5.xlarge", + "Type": "List" }, "KmsKeyArn": { "Default": "arn:aws:kms:us-east-1:123456789012:key/abcd1234-ef56-gh78-ij90-klmnopqrstuv", @@ -27,13 +31,21 @@ "Type": "Number" }, "SecurityGroupId": { - "Default": "sg-12345678", + "Default": "sg-0a1e1457229da0f74", "Type": "String" }, + "SecurityGroupIdList": { + "Default": "sg-0a1e1457229da0f74,sg-3b1f1457229da0f92", + "Type": "List" + }, "SubnetId": { - "Default": "subnet-12345678", + "Default": "subnet-01e6344879fd06036", "Type": "String" }, + "SubnetIdList": { + "Default": "subnet-01e6344879fd06036,subnet-0136378879fd07039", + "Type": "List" + }, "TargetCPU": { "Default": 75.0, "Type": "Number" @@ -76,7 +88,8 @@ "2xlarge" ] ] - } + }, + "c5.large" ], "Architectures": [ { @@ -157,6 +170,88 @@ ] }, "Type": "AWS::IAM::Role" + }, + "IntrinsicCapacityProviderTwo": { + "Properties": { + "CapacityProviderScalingConfig": { + "MaxVCpuCount": { + "Ref": "MaxVCpuCount" + }, + "ScalingMode": "Manual", + "ScalingPolicies": [ + { + "PredefinedMetricType": "LambdaCapacityProviderAverageCPUUtilization", + "TargetValue": { + "Ref": "TargetCPU" + } + } + ] + }, + "InstanceRequirements": { + "Architectures": { + "Ref": "ArchitecturesList" + }, + "ExcludedInstanceTypes": { + "Ref": "ExcludedInstanceTypeList" + } + }, + "KmsKeyArn": { + "Ref": "KmsKeyArn" + }, + "PermissionsConfig": { + "CapacityProviderOperatorRoleArn": { + "Fn::GetAtt": [ + "IntrinsicCapacityProviderTwoOperatorRole", + "Arn" + ] + } + }, + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ], + "VpcConfig": { + "SecurityGroupIds": { + "Ref": "SecurityGroupIdList" + }, + "SubnetIds": { + "Ref": "SubnetIdList" + } + } + }, + "Type": "AWS::Lambda::CapacityProvider" + }, + "IntrinsicCapacityProviderTwoOperatorRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws-us-gov:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" } } } diff --git a/tests/translator/output/capacity_provider_with_intrinsics.json b/tests/translator/output/capacity_provider_with_intrinsics.json index 05e55e80c..e0002bc76 100644 --- a/tests/translator/output/capacity_provider_with_intrinsics.json +++ b/tests/translator/output/capacity_provider_with_intrinsics.json @@ -10,13 +10,17 @@ "Default": "arm64", "Type": "String" }, + "ArchitecturesList": { + "Default": "x86_64", + "Type": "List" + }, "CapacityProviderName": { "Default": "intrinsic-capacity-provider", "Type": "String" }, - "ExcludedInstanceType": { - "Default": "t2.micro", - "Type": "String" + "ExcludedInstanceTypeList": { + "Default": "t2.micro,c5.xlarge", + "Type": "List" }, "KmsKeyArn": { "Default": "arn:aws:kms:us-east-1:123456789012:key/abcd1234-ef56-gh78-ij90-klmnopqrstuv", @@ -27,13 +31,21 @@ "Type": "Number" }, "SecurityGroupId": { - "Default": "sg-12345678", + "Default": "sg-0a1e1457229da0f74", "Type": "String" }, + "SecurityGroupIdList": { + "Default": "sg-0a1e1457229da0f74,sg-3b1f1457229da0f92", + "Type": "List" + }, "SubnetId": { - "Default": "subnet-12345678", + "Default": "subnet-01e6344879fd06036", "Type": "String" }, + "SubnetIdList": { + "Default": "subnet-01e6344879fd06036,subnet-0136378879fd07039", + "Type": "List" + }, "TargetCPU": { "Default": 75.0, "Type": "Number" @@ -76,7 +88,8 @@ "2xlarge" ] ] - } + }, + "c5.large" ], "Architectures": [ { @@ -157,6 +170,88 @@ ] }, "Type": "AWS::IAM::Role" + }, + "IntrinsicCapacityProviderTwo": { + "Properties": { + "CapacityProviderScalingConfig": { + "MaxVCpuCount": { + "Ref": "MaxVCpuCount" + }, + "ScalingMode": "Manual", + "ScalingPolicies": [ + { + "PredefinedMetricType": "LambdaCapacityProviderAverageCPUUtilization", + "TargetValue": { + "Ref": "TargetCPU" + } + } + ] + }, + "InstanceRequirements": { + "Architectures": { + "Ref": "ArchitecturesList" + }, + "ExcludedInstanceTypes": { + "Ref": "ExcludedInstanceTypeList" + } + }, + "KmsKeyArn": { + "Ref": "KmsKeyArn" + }, + "PermissionsConfig": { + "CapacityProviderOperatorRoleArn": { + "Fn::GetAtt": [ + "IntrinsicCapacityProviderTwoOperatorRole", + "Arn" + ] + } + }, + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ], + "VpcConfig": { + "SecurityGroupIds": { + "Ref": "SecurityGroupIdList" + }, + "SubnetIds": { + "Ref": "SubnetIdList" + } + } + }, + "Type": "AWS::Lambda::CapacityProvider" + }, + "IntrinsicCapacityProviderTwoOperatorRole": { + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": [ + "sts:AssumeRole" + ], + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + "arn:aws:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" + ], + "Tags": [ + { + "Key": "lambda:createdBy", + "Value": "SAM" + } + ] + }, + "Type": "AWS::IAM::Role" } } } diff --git a/tests/translator/output/error_capacity_provider_multiple_resources_validation.json b/tests/translator/output/error_capacity_provider_multiple_resources_validation.json index e68044bb0..a5e97c2ef 100644 --- a/tests/translator/output/error_capacity_provider_multiple_resources_validation.json +++ b/tests/translator/output/error_capacity_provider_multiple_resources_validation.json @@ -7,12 +7,12 @@ "Resource with id [CapacityProvider2] is invalid. ", "Property 'VpcConfig.SubnetIds' is required. ", "Resource with id [CapacityProvider3] is invalid. ", - "Property 'VpcConfig.SecurityGroupIds' value is not a valid list. ", - "Property 'VpcConfig.SubnetIds' value is not a valid list. ", + "Property 'VpcConfig.SecurityGroupIds' value must be dictionary or list. ", + "Property 'VpcConfig.SubnetIds' value must be dictionary or list. ", "Property 'ScalingConfig.MaxVCpuCount' value must be dictionary or integer. ", "Resource with id [CapacityProvider4] is invalid. ", "Property 'VpcConfig.InvalidProperty' is an invalid property. ", "Property 'ScalingConfig.AverageCPUUtilization' value must be dictionary or number." ], - "errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 4. Resource with id [CapacityProvider1] is invalid. Missing required property 'VpcConfig'. Resource with id [CapacityProvider2] is invalid. Property 'VpcConfig.SubnetIds' is required. Resource with id [CapacityProvider3] is invalid. Property 'VpcConfig.SecurityGroupIds' value is not a valid list. Property 'VpcConfig.SubnetIds' value is not a valid list. Property 'ScalingConfig.MaxVCpuCount' value must be dictionary or integer. Resource with id [CapacityProvider4] is invalid. Property 'VpcConfig.InvalidProperty' is an invalid property. Property 'ScalingConfig.AverageCPUUtilization' value must be dictionary or number." + "errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 4. Resource with id [CapacityProvider1] is invalid. Missing required property 'VpcConfig'. Resource with id [CapacityProvider2] is invalid. Property 'VpcConfig.SubnetIds' is required. Resource with id [CapacityProvider3] is invalid. Property 'VpcConfig.SecurityGroupIds' value must be dictionary or list. Property 'VpcConfig.SubnetIds' value must be dictionary or list. Property 'ScalingConfig.MaxVCpuCount' value must be dictionary or integer. Resource with id [CapacityProvider4] is invalid. Property 'VpcConfig.InvalidProperty' is an invalid property. Property 'ScalingConfig.AverageCPUUtilization' value must be dictionary or number." }