From fc9312b7461c15be0a73f272cf17a9a086112fa7 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Mon, 19 Aug 2019 10:22:34 +0200 Subject: [PATCH] add lambda --layers --- lib/dpl/providers/lambda.rb | 8 +++++--- spec/dpl/providers/lambda_spec.rb | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/dpl/providers/lambda.rb b/lib/dpl/providers/lambda.rb index 15fda7426..24490e61b 100644 --- a/lib/dpl/providers/lambda.rb +++ b/lib/dpl/providers/lambda.rb @@ -34,6 +34,7 @@ class Lambda < Provider opt '--dead_letter_arn ARN', 'ARN to an SNS or SQS resource used for the dead letter queue.' opt '--kms_key_arn ARN', 'KMS key ARN to use to encrypt environment_variables.' opt '--tracing_mode MODE', 'Tracing mode', default: 'PassThrough', enum: %w(Active PassThrough), note: 'Needs xray:PutTraceSegments xray:PutTelemetryRecords on the role' + opt '--layers LAYERS', 'Function layer arns', type: :array opt '--function_tags TAGS', 'List of tags to add to the function', type: :array, format: /[\w\-]+=.+/, note: 'Can be encrypted for added security' opt '--publish', 'Create a new version of the code instead of replacing the existing one.' opt '--zip PATH', 'Path to a packaged Lambda, a directory to package, or a single file to package', default: '.' @@ -107,7 +108,8 @@ def function_config runtime: runtime, dead_letter_config: dead_letter_arn, kms_key_arn: kms_key_arn, - tracing_config: tracing_mode + tracing_config: tracing_config, + layers: layers ) end @@ -146,8 +148,8 @@ def dead_letter_arn { target_arn: super } if dead_letter_arn? end - def tracing_mode - { mode: super } if tracing_mode? + def tracing_config + { mode: tracing_mode } if tracing_mode? end def function_tags diff --git a/spec/dpl/providers/lambda_spec.rb b/spec/dpl/providers/lambda_spec.rb index 1a447d1bd..ce7263bdf 100644 --- a/spec/dpl/providers/lambda_spec.rb +++ b/spec/dpl/providers/lambda_spec.rb @@ -193,6 +193,10 @@ describe 'given --function_tags key=value' do it { should have_called :tag_resource, Tags: { key: 'value' } } end + + describe 'given --layers one --layers two' do + it { should have_called :update_function_config, Layers: %w(one two) } + end end describe 'with ~/.aws/credentials' do