diff --git a/prefect_gcp/workers/cloud_run_v2.py b/prefect_gcp/workers/cloud_run_v2.py index e796e33..eb97afa 100644 --- a/prefect_gcp/workers/cloud_run_v2.py +++ b/prefect_gcp/workers/cloud_run_v2.py @@ -247,7 +247,7 @@ def _remove_vpc_access_if_unset(self): # if connector is the only key and it's not set, we'll remove it. # otherwise we'll pass whatever the user has provided. if len(vpc_access) == 1 and vpc_access.get("connector") is None: - self.job_body["template"]["template"]["vpcAccess"] = None + self.job_body["template"]["template"].pop("vpcAccess") # noinspection PyMethodParameters @validator("job_body") diff --git a/tests/test_cloud_run_worker_v2.py b/tests/test_cloud_run_worker_v2.py index 1b90281..ab3309c 100644 --- a/tests/test_cloud_run_worker_v2.py +++ b/tests/test_cloud_run_worker_v2.py @@ -132,8 +132,8 @@ def test_remove_vpc_access_if_unset(self, cloud_run_worker_v2_job_config): cloud_run_worker_v2_job_config._remove_vpc_access_if_unset() assert ( - cloud_run_worker_v2_job_config.job_body["template"]["template"]["vpcAccess"] - is None + "vpcAccess" + not in cloud_run_worker_v2_job_config.job_body["template"]["template"] ) def test_vpc_access_left_alone_if_connector_set(