diff --git a/chalice/package.py b/chalice/package.py index 284bc426e5..0292b9a1e4 100644 --- a/chalice/package.py +++ b/chalice/package.py @@ -114,7 +114,7 @@ def _generate_lambdafunction(self, resource, template): }, } if resource.environment_variables: - resources[cfn_name]['Properties']['EnvironmentVariables'] = { + resources[cfn_name]['Properties']['Environment'] = { 'Variables': resource.environment_variables } self._add_iam_role(resource, resources[cfn_name]) diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index 9f7d213649..2bb4e336aa 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -152,7 +152,7 @@ def test_adds_env_vars_when_provided(self, sample_app): function.environment_variables = {'foo': 'bar'} template = self.template_gen.generate_sam_template([function]) cfn_resource = list(template['Resources'].values())[0] - assert cfn_resource['Properties']['EnvironmentVariables'] == { + assert cfn_resource['Properties']['Environment'] == { 'Variables': { 'foo': 'bar' }