Skip to content

Commit

Permalink
Added google_compute_network_peering_routes_config to example so user…
Browse files Browse the repository at this point in the history
…s pick up the right thing to do (#9892) (#652)

[upstream:0767aacd3f074addbf06a59df80aa919e4062da8]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jan 30, 2024
1 parent 535123c commit 5c0b5ab
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Storage_pool_create/main.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 = <your_project>
location = "us-central1"
service_level = "PREMIUM"
capacity_gib = "2048"
Expand Down

0 comments on commit 5c0b5ab

Please sign in to comment.