Skip to content

Commit c066771

Browse files
Lambda Container Support (#92)
* Enable parsing Lambda Functions with container images * Add test for parsing Lambda Functions with container images
1 parent 4c6e96a commit c066771

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

lib/cfn-model/schema/AWS_Lambda_Function.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ mapping:
1414
required: yes
1515
Handler:
1616
type: any
17-
required: yes
17+
required: no
1818
Role:
1919
type: any
2020
required: yes
2121
Runtime:
2222
type: any
23-
required: yes
23+
required: no
2424
=:
2525
type: any
2626
=:

spec/parser/cfn_parser_lambda_function_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,18 @@
3434
expect(actual_computed_role).to be_nil
3535
end
3636
end
37+
38+
it 'does not have handler or runtime when using container image' do
39+
json_test_templates('lambda_function/lambda_function_with_container_image').each do |template|
40+
cfn_model = @cfn_parser.parse IO.read(template)
41+
lambda_functions = cfn_model.resources_by_type('AWS::Lambda::Function')
42+
43+
expect(lambda_functions.size).to eq 1
44+
lambda_function = lambda_functions.first
45+
46+
expect(lambda_function.handler).to be_nil
47+
expect(lambda_function.runtime).to be_nil
48+
end
49+
end
3750
end
3851
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Resources" : {
3+
"ContainerImageFunction": {
4+
"Type": "AWS::Lambda::Function",
5+
"Properties": {
6+
"Role": "arn:aws:iam::123456789012:role/LambdaExecutionRole",
7+
"Code": {
8+
"ImageUri": "123456789012.dkr.ecr.us-east-1.amazonaws.com/hello-world:latest"
9+
},
10+
"PackageType": "Image"
11+
}
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)