diff --git a/samtranslator/model/lambda_.py b/samtranslator/model/lambda_.py index e4603adf7..52de4a457 100644 --- a/samtranslator/model/lambda_.py +++ b/samtranslator/model/lambda_.py @@ -94,7 +94,7 @@ class LambdaLayerVersion(Resource): 'Content': PropertyType(True, is_type(dict)), 'Description': PropertyType(False, is_str()), 'LayerName': PropertyType(False, is_str()), - 'CompatibleRuntimes': PropertyType(False, list_of(is_str())), + 'CompatibleRuntimes': PropertyType(False, list_of(one_of(is_str(), is_type(dict)))), 'LicenseInfo': PropertyType(False, is_str()) } diff --git a/samtranslator/model/sam_resources.py b/samtranslator/model/sam_resources.py index 778143b67..6fa66be93 100644 --- a/samtranslator/model/sam_resources.py +++ b/samtranslator/model/sam_resources.py @@ -618,7 +618,7 @@ class SamLayerVersion(SamResourceMacro): 'LayerName': PropertyType(False, one_of(is_str(), is_type(dict))), 'Description': PropertyType(False, is_str()), 'ContentUri': PropertyType(True, one_of(is_str(), is_type(dict))), - 'CompatibleRuntimes': PropertyType(False, list_of(is_str())), + 'CompatibleRuntimes': PropertyType(False, list_of(one_of(is_str(), is_type(dict)))), 'LicenseInfo': PropertyType(False, is_str()), 'RetentionPolicy': PropertyType(False, is_str()) } diff --git a/tests/translator/input/layers_with_intrinsics.yaml b/tests/translator/input/layers_with_intrinsics.yaml index 70a9c8764..b593a7b63 100644 --- a/tests/translator/input/layers_with_intrinsics.yaml +++ b/tests/translator/input/layers_with_intrinsics.yaml @@ -7,6 +7,12 @@ Parameters: Default: MIT-0 License LayerRuntimeList: Type: CommaDelimitedList + LayerRuntimeString1: + Type: String + Default: nodejs6.10 + LayerRuntimeString2: + Type: String + Default: nodejs8.10 Resources: LayerWithLicenseIntrinsic: diff --git a/tests/translator/output/aws-cn/layers_with_intrinsics.json b/tests/translator/output/aws-cn/layers_with_intrinsics.json index c8351374f..feaa6b259 100644 --- a/tests/translator/output/aws-cn/layers_with_intrinsics.json +++ b/tests/translator/output/aws-cn/layers_with_intrinsics.json @@ -1,26 +1,34 @@ { "Parameters": { "LayerLicenseInfo": { - "Default": "MIT-0 License", + "Default": "MIT-0 License", "Type": "String" - }, + }, "LayerRuntimeList": { "Type": "CommaDelimitedList" - }, + }, "LayerNameParam": { - "Default": "SomeLayerName", + "Default": "SomeLayerName", + "Type": "String" + }, + "LayerRuntimeString1": { + "Default": "nodejs6.10", + "Type": "String" + }, + "LayerRuntimeString2": { + "Default": "nodejs8.10", "Type": "String" } - }, + }, "Resources": { "LayerWithNameIntrinsiccf8baed8b9": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, + }, "LayerName": "SomeLayerName" } }, @@ -49,28 +57,28 @@ } }, "LayerWithRuntimesIntrinsic1a006faa85": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, - "LayerName": "LayerWithRuntimesIntrinsic", + }, + "LayerName": "LayerWithRuntimesIntrinsic", "CompatibleRuntimes": { "Ref": "LayerRuntimeList" } } - }, + }, "LayerWithLicenseIntrinsic965c8d0c9b": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, - "LayerName": "LayerWithLicenseIntrinsic", + }, + "LayerName": "LayerWithLicenseIntrinsic", "LicenseInfo": "MIT-0 License" } }, @@ -89,4 +97,3 @@ } } } - diff --git a/tests/translator/output/aws-us-gov/layers_with_intrinsics.json b/tests/translator/output/aws-us-gov/layers_with_intrinsics.json index a0a46e7d7..8a087afc1 100644 --- a/tests/translator/output/aws-us-gov/layers_with_intrinsics.json +++ b/tests/translator/output/aws-us-gov/layers_with_intrinsics.json @@ -1,26 +1,34 @@ { "Parameters": { "LayerLicenseInfo": { - "Default": "MIT-0 License", + "Default": "MIT-0 License", "Type": "String" - }, + }, "LayerRuntimeList": { "Type": "CommaDelimitedList" - }, + }, "LayerNameParam": { - "Default": "SomeLayerName", + "Default": "SomeLayerName", + "Type": "String" + }, + "LayerRuntimeString1": { + "Default": "nodejs6.10", + "Type": "String" + }, + "LayerRuntimeString2": { + "Default": "nodejs8.10", "Type": "String" } - }, + }, "Resources": { "LayerWithNameIntrinsiccf8baed8b9": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, + }, "LayerName": "SomeLayerName" } }, @@ -49,28 +57,28 @@ } }, "LayerWithRuntimesIntrinsic1a006faa85": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, - "LayerName": "LayerWithRuntimesIntrinsic", + }, + "LayerName": "LayerWithRuntimesIntrinsic", "CompatibleRuntimes": { "Ref": "LayerRuntimeList" } } - }, + }, "LayerWithLicenseIntrinsic965c8d0c9b": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, - "LayerName": "LayerWithLicenseIntrinsic", + }, + "LayerName": "LayerWithLicenseIntrinsic", "LicenseInfo": "MIT-0 License" } }, diff --git a/tests/translator/output/layers_with_intrinsics.json b/tests/translator/output/layers_with_intrinsics.json index 79e2dea55..41c9d1b26 100644 --- a/tests/translator/output/layers_with_intrinsics.json +++ b/tests/translator/output/layers_with_intrinsics.json @@ -1,26 +1,34 @@ { "Parameters": { "LayerLicenseInfo": { - "Default": "MIT-0 License", + "Default": "MIT-0 License", "Type": "String" - }, + }, "LayerRuntimeList": { "Type": "CommaDelimitedList" - }, + }, "LayerNameParam": { - "Default": "SomeLayerName", + "Default": "SomeLayerName", + "Type": "String" + }, + "LayerRuntimeString1": { + "Default": "nodejs6.10", + "Type": "String" + }, + "LayerRuntimeString2": { + "Default": "nodejs8.10", "Type": "String" } - }, + }, "Resources": { "LayerWithNameIntrinsiccf8baed8b9": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, + }, "LayerName": "SomeLayerName" } }, @@ -49,28 +57,28 @@ } }, "LayerWithRuntimesIntrinsic1a006faa85": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, - "LayerName": "LayerWithRuntimesIntrinsic", + }, + "LayerName": "LayerWithRuntimesIntrinsic", "CompatibleRuntimes": { "Ref": "LayerRuntimeList" } } - }, + }, "LayerWithLicenseIntrinsic965c8d0c9b": { - "DeletionPolicy": "Retain", - "Type": "AWS::Lambda::LayerVersion", + "DeletionPolicy": "Retain", + "Type": "AWS::Lambda::LayerVersion", "Properties": { "Content": { - "S3Bucket": "sam-demo-bucket", + "S3Bucket": "sam-demo-bucket", "S3Key": "layer.zip" - }, - "LayerName": "LayerWithLicenseIntrinsic", + }, + "LayerName": "LayerWithLicenseIntrinsic", "LicenseInfo": "MIT-0 License" } },