From 83507fbc371c1e999d3b4dd90af4b709e65bcdea Mon Sep 17 00:00:00 2001 From: Oide Brett <32061073+oidebrett@users.noreply.github.com> Date: Wed, 18 Nov 2020 08:45:31 +0000 Subject: [PATCH] fixed issue in update_configuration for lambda when setting VPC config property (#3479) --- moto/awslambda/models.py | 2 +- tests/test_awslambda/test_lambda.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/moto/awslambda/models.py b/moto/awslambda/models.py index a26fcba40..475ef3086 100644 --- a/moto/awslambda/models.py +++ b/moto/awslambda/models.py @@ -305,7 +305,7 @@ class LambdaFunction(CloudFormationModel, DockerModel): elif key == "Timeout": self.timeout = value elif key == "VpcConfig": - self.vpc_config = value + self._vpc_config = value elif key == "Environment": self.environment_vars = value["Variables"] diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py index 7e4fc22f5..8308195fb 100644 --- a/tests/test_awslambda/test_lambda.py +++ b/tests/test_awslambda/test_lambda.py @@ -1536,6 +1536,7 @@ def test_update_configuration(): Handler="lambda_function.new_lambda_handler", Runtime="python3.6", Timeout=7, + VpcConfig={"SecurityGroupIds": ["sg-123abc"], "SubnetIds": ["subnet-123abc"]}, Environment={"Variables": {"test_environment": "test_value"}}, ) @@ -1548,6 +1549,11 @@ def test_update_configuration(): assert updated_config["Environment"]["Variables"] == { "test_environment": "test_value" } + assert updated_config["VpcConfig"] == { + "SecurityGroupIds": ["sg-123abc"], + "SubnetIds": ["subnet-123abc"], + "VpcId": "vpc-123abc", + } @mock_lambda