diff --git a/lib/cfn-model/schema/AWS_Lambda_Function.yml b/lib/cfn-model/schema/AWS_Lambda_Function.yml index 916936f..4941336 100644 --- a/lib/cfn-model/schema/AWS_Lambda_Function.yml +++ b/lib/cfn-model/schema/AWS_Lambda_Function.yml @@ -14,13 +14,13 @@ mapping: required: yes Handler: type: any - required: yes + required: no Role: type: any required: yes Runtime: type: any - required: yes + required: no =: type: any =: diff --git a/spec/parser/cfn_parser_lambda_function_spec.rb b/spec/parser/cfn_parser_lambda_function_spec.rb index d54dbe2..269c04c 100644 --- a/spec/parser/cfn_parser_lambda_function_spec.rb +++ b/spec/parser/cfn_parser_lambda_function_spec.rb @@ -34,5 +34,18 @@ expect(actual_computed_role).to be_nil end end + + it 'does not have handler or runtime when using container image' do + json_test_templates('lambda_function/lambda_function_with_container_image').each do |template| + cfn_model = @cfn_parser.parse IO.read(template) + lambda_functions = cfn_model.resources_by_type('AWS::Lambda::Function') + + expect(lambda_functions.size).to eq 1 + lambda_function = lambda_functions.first + + expect(lambda_function.handler).to be_nil + expect(lambda_function.runtime).to be_nil + end + end end end diff --git a/spec/test_templates/json/lambda_function/lambda_function_with_container_image.json b/spec/test_templates/json/lambda_function/lambda_function_with_container_image.json new file mode 100644 index 0000000..db2274c --- /dev/null +++ b/spec/test_templates/json/lambda_function/lambda_function_with_container_image.json @@ -0,0 +1,14 @@ +{ + "Resources" : { + "ContainerImageFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Role": "arn:aws:iam::123456789012:role/LambdaExecutionRole", + "Code": { + "ImageUri": "123456789012.dkr.ecr.us-east-1.amazonaws.com/hello-world:latest" + }, + "PackageType": "Image" + } + } + } +}