Skip to content

Commit to merge in tim's changes #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
functions:
app1:
handler: handler.lambda_handler
runtime: python3.6
runtime: python3.10
code_uri: app1/src.zip
timeout: 30
environment:
Expand Down
16 changes: 16 additions & 0 deletions lambda.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
Role(FnGetAtt("#{function_name}Role", 'Arn'))
Runtime(lambda_config['runtime'])
Timeout(lambda_config['timeout'] || 10)
Layers(lambda_config['layers']) if lambda_config.has_key?('layers')
if (lambda_config.has_key? 'enable_eni') && (lambda_config['enable_eni'])
VpcConfig({
SecurityGroupIds: [
Expand All @@ -68,6 +69,9 @@
if !lambda_config['named'].nil? && lambda_config['named']
FunctionName(function_name)
end
if !lambda_config['dlq_target_arn'].nil? && lambda_config['dlq_target_arn']
DeadLetterConfig({'TargetArn' => lambda_config['dlq_target_arn']})
end
Tags tags
end

Expand Down Expand Up @@ -138,6 +142,18 @@
SourceArn FnSub("arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/#{event['log_group']}:*")
end


when 's3'

Lambda_Permission("#{function_name}#{name}Permissions") do
FunctionName Ref(function_name)
Action 'lambda:InvokeFunction'
Principal 's3.amazonaws.com'
SourceArn event['bucket']
end



end

end if lambda_config.has_key?('events')
Expand Down
6 changes: 5 additions & 1 deletion spec/function_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
end

it "to have property Runtime" do
expect(resource["Properties"]["Runtime"]).to eq("python3.9")
expect(resource["Properties"]["Runtime"]).to eq("python3.10")
end

it "to have property Timeout" do
Expand All @@ -98,6 +98,10 @@
expect(resource["Properties"]["Tags"]).to eq([{"Key"=>"Environment", "Value"=>{"Ref"=>"EnvironmentName"}}, {"Key"=>"EnvironmentType", "Value"=>{"Ref"=>"EnvironmentType"}}])
end

it "to have property Layers" do
expect(resource["Properties"]["Layers"]).to eq(["arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1"])
end

end

context "myfunctionLogGroup" do
Expand Down
4 changes: 3 additions & 1 deletion tests/function.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution:
functions:
myfunction:
handler: handler.lambda_handler
runtime: python3.9
runtime: python3.10
code_uri: myfunction/src.zip
timeout: 30
environment:
Expand All @@ -25,6 +25,8 @@ functions:
- '*'
enable_eni: true
log_retention: 7
layers:
- arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1
events:
cron:
type: schedule
Expand Down