Skip to content

Commit

Permalink
Lambda Container Support (#92)
Browse files Browse the repository at this point in the history
* Enable parsing Lambda Functions with container images

* Add test for parsing Lambda Functions with container images
  • Loading branch information
djonesshargani1-godaddy committed Aug 13, 2021
1 parent 4c6e96a commit c066771
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cfn-model/schema/AWS_Lambda_Function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
=:
Expand Down
13 changes: 13 additions & 0 deletions spec/parser/cfn_parser_lambda_function_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}

0 comments on commit c066771

Please sign in to comment.