@@ -271,44 +271,45 @@ func TestAccScalewayLbLb_WithSeveralPrivateNetworks(t *testing.T) {
271
271
resource .ParallelTest (t , resource.TestCase {
272
272
PreCheck : func () { testAccPreCheck (t ) },
273
273
ProviderFactories : tt .ProviderFactories ,
274
- CheckDestroy : testAccCheckScalewayLbDestroy (tt ),
274
+ CheckDestroy : resource .ComposeTestCheckFunc (
275
+ testAccCheckScalewayInstanceServerDestroy (tt ),
276
+ testAccCheckScalewayLbDestroy (tt ),
277
+ testAccCheckScalewayLbIPDestroy (tt ),
278
+ testAccCheckScalewayVPCGatewayNetworkDestroy (tt ),
279
+ testAccCheckScalewayVPCPrivateNetworkDestroy (tt ),
280
+ testAccCheckScalewayVPCPublicGatewayDHCPDestroy (tt ),
281
+ testAccCheckScalewayVPCPublicGatewayDestroy (tt ),
282
+ testAccCheckScalewayVPCPublicGatewayIPDestroy (tt ),
283
+ ),
275
284
Steps : []resource.TestStep {
276
285
{
277
286
Config : `
278
- ### IP for LB IP
279
- resource scaleway_lb_ip ip01 {
280
- }
281
-
282
- ### IP for Public Gateway
283
- resource "scaleway_vpc_public_gateway_ip" "main" {
287
+ resource "scaleway_vpc_private_network" dhcp_network {
288
+ name = "private network with a DHCP config"
284
289
}
285
-
286
- ### Scaleway Private Network
287
- resource scaleway_vpc_private_network main {
290
+
291
+ resource scaleway_vpc_private_network static_network {
288
292
name = "private network with static config"
289
293
}
290
-
291
- ### The Public Gateway with the Attached IP
294
+
295
+
296
+ resource "scaleway_vpc_public_gateway_ip" "main" {
297
+ }
298
+
292
299
resource "scaleway_vpc_public_gateway" "main" {
293
300
name = "tf-test-public-gw"
294
301
type = "VPC-GW-S"
295
302
ip_id = scaleway_vpc_public_gateway_ip.main.id
296
303
}
297
304
298
- ### Scaleway Private Network
299
- resource "scaleway_vpc_private_network" "pn" {
300
- name = "private network with a DHCP config"
301
- }
302
-
303
- ### DHCP Space of VPC
304
305
resource "scaleway_vpc_public_gateway_dhcp" "main" {
305
306
subnet = "10.0.0.0/24"
306
307
}
307
308
308
309
### VPC Gateway Network
309
310
resource "scaleway_vpc_gateway_network" "main" {
310
311
gateway_id = scaleway_vpc_public_gateway.main.id
311
- private_network_id = scaleway_vpc_private_network.pn .id
312
+ private_network_id = scaleway_vpc_private_network.dhcp_network .id
312
313
dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id
313
314
cleanup_dhcp = true
314
315
enable_masquerade = true
@@ -322,22 +323,27 @@ func TestAccScalewayLbLb_WithSeveralPrivateNetworks(t *testing.T) {
322
323
enable_ipv6 = false
323
324
324
325
private_network {
325
- pn_id = scaleway_vpc_private_network.pn .id
326
+ pn_id = scaleway_vpc_private_network.dhcp_network .id
326
327
}
328
+
329
+ depends_on = [scaleway_vpc_private_network.dhcp_network]
327
330
}
328
-
331
+
332
+ resource scaleway_lb_ip ip01 {
333
+ }
334
+
329
335
resource scaleway_lb lb01 {
330
336
ip_id = scaleway_lb_ip.ip01.id
331
337
name = "test-lb-with-private-network-configs"
332
338
type = "LB-S"
333
339
334
340
private_network {
335
- private_network_id = scaleway_vpc_private_network.main .id
341
+ private_network_id = scaleway_vpc_private_network.static_network .id
336
342
static_config = ["172.16.0.100", "172.16.0.101"]
337
343
}
338
344
339
345
private_network {
340
- private_network_id = scaleway_vpc_private_network.pn .id
346
+ private_network_id = scaleway_vpc_private_network.dhcp_network .id
341
347
dhcp_config = true
342
348
}
343
349
@@ -347,7 +353,8 @@ func TestAccScalewayLbLb_WithSeveralPrivateNetworks(t *testing.T) {
347
353
Check : resource .ComposeTestCheckFunc (
348
354
testAccCheckScalewayLbExists (tt , "scaleway_lb.lb01" ),
349
355
testAccCheckScalewayLbIPExists (tt , "scaleway_lb_ip.ip01" ),
350
- resource .TestCheckResourceAttrSet ("scaleway_vpc_private_network.pn" , "name" ),
356
+ resource .TestCheckResourceAttrSet ("scaleway_vpc_private_network.dhcp_network" , "name" ),
357
+ resource .TestCheckResourceAttrSet ("scaleway_vpc_private_network.static_network" , "name" ),
351
358
resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
352
359
"private_network.0.static_config.0" , "172.16.0.100" ),
353
360
resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
0 commit comments