@@ -27,6 +27,7 @@ func TestAccLustreInstanceDatasource_basic(t *testing.T) {
2727 t .Parallel ()
2828
2929 context := map [string ]interface {}{
30+ "network_name" : acctest .BootstrapSharedTestNetwork (t , "default-vpc" ),
3031 "random_suffix" : acctest .RandString (t , 10 ),
3132 }
3233
@@ -57,36 +58,21 @@ resource "google_lustre_instance" "instance" {
5758 location = "us-central1-a"
5859 filesystem = "testfs"
5960 capacity_gib = 18000
60- network = google_compute_network.producer_net .id
61+ network = data. google_compute_network.lustre-network .id
6162 gke_support_enabled = false
6263 per_unit_storage_throughput = 1000
63- depends_on = [ google_service_networking_connection.service_con ]
6464}
6565
66- resource "google_compute_subnetwork" "producer_subnet" {
67- name = "tf-test-my-subnet-%{random_suffix}"
68- ip_cidr_range = "10.0.0.248/29"
69- region = "us-central1"
70- network = google_compute_network.producer_net.id
71- }
72-
73- resource "google_compute_network" "producer_net" {
74- name = "tf-test-my-network-%{random_suffix}"
75- auto_create_subnetworks = false
76- }
77-
78- resource "google_compute_global_address" "private_ip_alloc" {
79- name = "private-ip-alloc-%{random_suffix}"
80- purpose = "VPC_PEERING"
81- address_type = "INTERNAL"
82- prefix_length = 16
83- network = google_compute_network.producer_net.id
84- }
85-
86- resource "google_service_networking_connection" "service_con" {
87- network = google_compute_network.producer_net.id
88- service = "servicenetworking.googleapis.com"
89- reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
66+ // This example assumes this network already exists.
67+ // The API creates a tenant network per network authorized for a
68+ // Lustre instance and that network is not deleted when the user-created
69+ // network (authorized_network) is deleted, so this prevents issues
70+ // with tenant network quota.
71+ // If this network hasn't been created and you are using this example in your
72+ // config, add an additional network resource or change
73+ // this from "data"to "resource"
74+ data "google_compute_network" "lustre-network" {
75+ name = "%{network_name}"
9076}
9177
9278data "google_lustre_instance" "default" {
0 commit comments