Skip to content

Commit

Permalink
Merge pull request #1070 from travis-ci/sf-lambda-layers
Browse files Browse the repository at this point in the history
add lambda --layers (see #933)
  • Loading branch information
svenfuchs committed Aug 20, 2019
2 parents 1d28f9c + fc9312b commit 79d15e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/dpl/providers/lambda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: '.'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/dpl/providers/lambda_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 79d15e5

Please sign in to comment.