From 5c0b5ab90fd16638669d657f9113213b7bc14b90 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 30 Jan 2024 09:17:59 -0800 Subject: [PATCH] Added google_compute_network_peering_routes_config to example so users pick up the right thing to do (#9892) (#652) [upstream:0767aacd3f074addbf06a59df80aa919e4062da8] Signed-off-by: Modular Magician --- Storage_pool_create/main.tf | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Storage_pool_create/main.tf b/Storage_pool_create/main.tf index 0a22f929..5637ebef 100644 --- a/Storage_pool_create/main.tf +++ b/Storage_pool_create/main.tf @@ -1,9 +1,10 @@ - +# Create a network or use datasource to reference existing network resource "google_compute_network" "peering_network" { name = "test-network-${local.name_suffix}" } -# Create an IP address +# Reserve a CIDR for NetApp Volumes to use +# When using shared-VPCs, this resource needs to be created in host project resource "google_compute_global_address" "private_ip_alloc" { name = "test-address-${local.name_suffix}" purpose = "VPC_PEERING" @@ -12,15 +13,29 @@ resource "google_compute_global_address" "private_ip_alloc" { network = google_compute_network.peering_network.id } -# Create a private connection +# Create a Private Service Access connection +# When using shared-VPCs, this resource needs to be created in host project resource "google_service_networking_connection" "default" { network = google_compute_network.peering_network.id service = "netapp.servicenetworking.goog" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } +# Modify the PSA Connection to allow import/export of custom routes +# When using shared-VPCs, this resource needs to be created in host project +resource "google_compute_network_peering_routes_config" "route_updates" { + peering = google_service_networking_connection.default.peering + network = google_compute_network.peering_network.name + + import_custom_routes = true + export_custom_routes = true +} + +# Create a storage pool +# Create this resource in the project which is expected to own the volumes resource "google_netapp_storage_pool" "test_pool" { name = "test-pool-${local.name_suffix}" + # project = location = "us-central1" service_level = "PREMIUM" capacity_gib = "2048"