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