1
- # Create a network or use datasource to reference existing network
2
- resource "google_compute_network" "peering_network" {
1
+ data "google_compute_network" "default" {
3
2
name = " test-network-${ local . name_suffix } "
4
3
}
5
4
6
- # Reserve a CIDR for NetApp Volumes to use
7
- # When using shared-VPCs, this resource needs to be created in host project
8
- resource "google_compute_global_address" "private_ip_alloc" {
9
- name = " test-address-${ local . name_suffix } "
10
- purpose = " VPC_PEERING"
11
- address_type = " INTERNAL"
12
- prefix_length = 16
13
- network = google_compute_network. peering_network . id
14
- }
15
-
16
- # Create a Private Service Access connection
17
- # When using shared-VPCs, this resource needs to be created in host project
18
- resource "google_service_networking_connection" "default" {
19
- network = google_compute_network. peering_network . id
20
- service = " netapp.servicenetworking.goog"
21
- reserved_peering_ranges = [google_compute_global_address . private_ip_alloc . name ]
22
- }
23
-
24
- # Modify the PSA Connection to allow import/export of custom routes
25
- # When using shared-VPCs, this resource needs to be created in host project
26
- resource "google_compute_network_peering_routes_config" "route_updates" {
27
- peering = google_service_networking_connection. default . peering
28
- network = google_compute_network. peering_network . name
29
-
30
- import_custom_routes = true
31
- export_custom_routes = true
32
- }
33
-
34
5
# Create a storage pool
35
6
# Create this resource in the project which is expected to own the volumes
36
7
resource "google_netapp_storage_pool" "test_pool" {
@@ -39,5 +10,5 @@ resource "google_netapp_storage_pool" "test_pool" {
39
10
location = " us-central1"
40
11
service_level = " PREMIUM"
41
12
capacity_gib = " 2048"
42
- network = google_compute_network. peering_network . id
13
+ network = data . google_compute_network . default . id
43
14
}
0 commit comments