From 0f12598a577c039344baedb1e1d84cd4c4910500 Mon Sep 17 00:00:00 2001 From: Imran Nayer Date: Mon, 8 Jan 2024 13:42:24 -0600 Subject: [PATCH] feat: added networkconnectivity in shared VPC host access (#876) --- modules/shared_vpc_access/main.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/shared_vpc_access/main.tf b/modules/shared_vpc_access/main.tf index fa56ec88..05fd0697 100644 --- a/modules/shared_vpc_access/main.tf +++ b/modules/shared_vpc_access/main.tf @@ -29,6 +29,7 @@ locals { "vpcaccess.googleapis.com" : format("service-%s@gcp-sa-vpcaccess.iam.gserviceaccount.com", local.service_project_number) "datastream.googleapis.com" : format("service-%s@gcp-sa-datastream.iam.gserviceaccount.com", local.service_project_number) "notebooks.googleapis.com" : format("service-%s@gcp-sa-notebooks.iam.gserviceaccount.com", local.service_project_number) + "networkconnectivity.googleapis.com" : format("service-%s@gcp-sa-networkconnectivity.iam.gserviceaccount.com", local.service_project_number) } gke_shared_vpc_enabled = contains(var.active_apis, "container.googleapis.com") composer_shared_vpc_enabled = contains(var.active_apis, "composer.googleapis.com") @@ -46,6 +47,8 @@ locals { if "dataflow.googleapis.com" compute.networkUser role granted to dataflow service account for Dataflow on shared VPC subnets if "composer.googleapis.com" compute.networkUser role granted to composer service account for Composer on shared VPC subnets if "notebooks.googleapis.com" compute.networkUser role granted to notebooks service account for Notebooks on shared VPC Project + if "networkconnectivity.googleapis.com" compute.networkUser role granted to notebooks service account for Network Connectivity on shared VPC Project + See: https://cloud.google.com/vpc/docs/configure-service-connection-policies#configure-host-project See: https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-shared-vpc https://cloud.google.com/dataflow/docs/concepts/security-and-permissions#cloud_dataflow_service_account https://cloud.google.com/composer/docs/how-to/managing/configuring-shared-vpc @@ -100,6 +103,7 @@ resource "google_compute_subnetwork_iam_member" "cloudservices_shared_vpc_subnet if "dataflow.googleapis.com" compute.networkUser role granted to dataflow service account for Dataflow on shared VPC Project if no subnets defined if "composer.googleapis.com" compute.networkUser role granted to composer service account for Composer on shared VPC Project if no subnets defined if "notebooks.googleapis.com" compute.networkUser role granted to notebooks service account for Notebooks on shared VPC Project if no subnets defined + if "networkconnectivity.googleapis.com" compute.networkUser role granted to notebooks service account for Notebooks on shared VPC Project if no subnets defined *****************************************/ resource "google_project_iam_member" "service_shared_vpc_user" { for_each = (length(var.shared_vpc_subnets) == 0) && var.enable_shared_vpc_service_project && var.grant_network_role ? toset(local.active_apis) : []