Skip to content

Commit 5a3efa6

Browse files
committed
google_compute_network_peering_routes_config cannot handle network_id
1 parent 783860a commit 5a3efa6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • community/modules/network/private-service-access

community/modules/network/private-service-access/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ locals {
1919
labels = merge(var.labels, { ghpc_module = "private-service-access", ghpc_role = "network" })
2020
}
2121

22+
locals {
23+
split_network_id = split("/", var.network_id)
24+
network_name = local.split_network_id[4]
25+
network_project = local.split_network_id[1]
26+
}
27+
2228
resource "random_id" "resource_name_suffix" {
2329
byte_length = 4
2430
}
@@ -45,7 +51,8 @@ resource "google_service_networking_connection" "private_vpc_connection" {
4551
# Google Cloud NetApp Volumes need enablement of custom_route import and export
4652
resource "google_compute_network_peering_routes_config" "private_vpc_peering_routes_gcnv" {
4753
count = var.service_name == "netapp.servicenetworking.goog" ? 1 : 0
48-
network = var.network_id
54+
project = local.network_project
55+
network = local.network_name
4956
peering = google_service_networking_connection.private_vpc_connection.peering
5057

5158
export_custom_routes = true

0 commit comments

Comments
 (0)