Skip to content

Commit

Permalink
add layer support
Browse files Browse the repository at this point in the history
  • Loading branch information
kapilt committed Jun 3, 2019
1 parent 4f8ddd0 commit cf2a95a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chalice/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ def _generate_lambdafunction(self, resource, template):
func_definition['environment'] = {
'variables': resource.environment_variables
}
if resource.layers:
func_definition['layers'] = list(resource.layers)

if isinstance(resource.role, models.ManagedIAMRole):
func_definition['role'] = '${aws_iam_role.%s.arn}' % (
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ def test_adds_vpc_config_when_provided(self):
'subnet_ids': ['sn1', 'sn2'],
'security_group_ids': ['sg1', 'sg2']}

def test_adds_layers_when_provided(self):
function = self.lambda_function()
function.layers = layers = ['arn://layer1', 'arn://layer2']
template = self.template_gen.generate([function])
tf_resource = self.get_function(template)
assert tf_resource['layers'] == layers

def test_adds_reserved_concurrency_when_provided(self, sample_app):
function = self.lambda_function()
function.reserved_concurrency = 5
Expand Down

0 comments on commit cf2a95a

Please sign in to comment.