@@ -80,6 +80,121 @@ data "google_compute_network" "lustre-network" {
8080` , context )
8181}
8282
83+ func TestAccLustreInstance_withAccessRulesOptions (t * testing.T ) {
84+ t .Parallel ()
85+
86+ context := map [string ]interface {}{
87+ "network_name" : acctest .BootstrapSharedTestNetwork (t , "default-vpc" ),
88+ "random_suffix" : acctest .RandString (t , 10 ),
89+ }
90+
91+ acctest .VcrTest (t , resource.TestCase {
92+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
93+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
94+ Steps : []resource.TestStep {
95+ {
96+ Config : testAccLustreInstance_withAccessRulesOptions (context ),
97+ },
98+ {
99+ ResourceName : "google_lustre_instance.instance" ,
100+ ImportState : true ,
101+ ImportStateVerify : true ,
102+ ImportStateVerifyIgnore : []string {"instance_id" , "labels" , "gke_support_enabled" , "location" , "terraform_labels" },
103+ },
104+ {
105+ Config : testAccLustreInstance_withAccessRulesOptionsUpdate (context ),
106+ ConfigPlanChecks : resource.ConfigPlanChecks {
107+ PreApply : []plancheck.PlanCheck {
108+ plancheck .ExpectResourceAction (
109+ "google_lustre_instance.instance" ,
110+ plancheck .ResourceActionUpdate ,
111+ ),
112+ },
113+ },
114+ },
115+ {
116+ ResourceName : "google_lustre_instance.instance" ,
117+ ImportState : true ,
118+ ImportStateVerify : true ,
119+ ImportStateVerifyIgnore : []string {"instance_id" , "labels" , "gke_support_enabled" , "location" , "terraform_labels" },
120+ },
121+ },
122+ })
123+ }
124+
125+ func testAccLustreInstance_withAccessRulesOptions (context map [string ]interface {}) string {
126+ return acctest .Nprintf (`
127+ resource "google_lustre_instance" "instance" {
128+ instance_id = "tf-test-my-instance%{random_suffix}"
129+ location = "us-central1-a"
130+ filesystem = "testfs"
131+ network = data.google_compute_network.lustre-network.id
132+ gke_support_enabled = false
133+ capacity_gib = 18000
134+ per_unit_storage_throughput = 1000
135+
136+ access_rules_options {
137+ default_squash_mode = "ROOT_SQUASH"
138+ default_squash_uid = 65534
139+
140+ access_rules {
141+ name = "admin_hosts"
142+ ip_address_ranges = ["192.168.0.0/24","10.0.1.10/32"]
143+ squash_mode = "NO_SQUASH"
144+ }
145+
146+ access_rules {
147+ name = "another_admin"
148+ ip_address_ranges = ["172.16.5.0/24"]
149+ squash_mode = "NO_SQUASH"
150+ }
151+ }
152+
153+ timeouts {
154+ create = "120m"
155+ }
156+ }
157+
158+ data "google_compute_network" "lustre-network" {
159+ name = "%{network_name}"
160+ }
161+ ` , context )
162+ }
163+
164+ func testAccLustreInstance_withAccessRulesOptionsUpdate (context map [string ]interface {}) string {
165+ return acctest .Nprintf (`
166+ resource "google_lustre_instance" "instance" {
167+ instance_id = "tf-test-my-instance%{random_suffix}"
168+ location = "us-central1-a"
169+ filesystem = "testfs"
170+ network = data.google_compute_network.lustre-network.id
171+ gke_support_enabled = false
172+ capacity_gib = 18000
173+ per_unit_storage_throughput = 1000
174+
175+ access_rules_options {
176+ default_squash_mode = "NO_SQUASH"
177+ default_squash_uid = 0
178+ default_squash_gid = 0
179+
180+ access_rules {
181+ name = "updated_admin"
182+ ip_address_ranges = ["10.0.0.0/8"]
183+ squash_mode = "NO_SQUASH"
184+ }
185+ }
186+
187+ timeouts {
188+ create = "120m"
189+ }
190+ }
191+
192+ data "google_compute_network" "lustre-network" {
193+ name = "%{network_name}"
194+ }
195+ ` , context )
196+ }
197+
83198func TestAccLustreInstance_withKmsKey (t * testing.T ) {
84199 t .Parallel ()
85200
0 commit comments