@@ -265,7 +265,7 @@ func TestAccScalewayLbLb_WithIP(t *testing.T) {
265
265
})
266
266
}
267
267
268
- func TestAccScalewayLbLb_WithSeveralPrivateNetworks (t * testing.T ) {
268
+ func TestAccScalewayLbLb_WithPrivateNetworksOnDHCPConfig (t * testing.T ) {
269
269
tt := NewTestTools (t )
270
270
defer tt .Cleanup ()
271
271
resource .ParallelTest (t , resource.TestCase {
@@ -284,32 +284,31 @@ func TestAccScalewayLbLb_WithSeveralPrivateNetworks(t *testing.T) {
284
284
Steps : []resource.TestStep {
285
285
{
286
286
Config : `
287
- resource "scaleway_vpc_private_network" dhcp_network {
288
- name = "private network with a DHCP config"
289
- }
290
-
291
- resource scaleway_vpc_private_network static_network {
292
- name = "private network with static config"
293
- }
294
-
295
-
287
+ ### IP for Public Gateway
296
288
resource "scaleway_vpc_public_gateway_ip" "main" {
297
289
}
298
290
291
+ ### The Public Gateway with the Attached IP
299
292
resource "scaleway_vpc_public_gateway" "main" {
300
293
name = "tf-test-public-gw"
301
294
type = "VPC-GW-S"
302
295
ip_id = scaleway_vpc_public_gateway_ip.main.id
303
296
}
304
297
298
+ ### Scaleway Private Network
299
+ resource "scaleway_vpc_private_network" "main" {
300
+ name = "private network with a DHCP config"
301
+ }
302
+
303
+ ### DHCP Space of VPC
305
304
resource "scaleway_vpc_public_gateway_dhcp" "main" {
306
305
subnet = "10.0.0.0/24"
307
306
}
308
307
309
308
### VPC Gateway Network
310
309
resource "scaleway_vpc_gateway_network" "main" {
311
310
gateway_id = scaleway_vpc_public_gateway.main.id
312
- private_network_id = scaleway_vpc_private_network.dhcp_network .id
311
+ private_network_id = scaleway_vpc_private_network.main .id
313
312
dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id
314
313
cleanup_dhcp = true
315
314
enable_masquerade = true
@@ -323,27 +322,21 @@ func TestAccScalewayLbLb_WithSeveralPrivateNetworks(t *testing.T) {
323
322
enable_ipv6 = false
324
323
325
324
private_network {
326
- pn_id = scaleway_vpc_private_network.dhcp_network .id
325
+ pn_id = scaleway_vpc_private_network.main .id
327
326
}
328
-
329
- depends_on = [scaleway_vpc_private_network.dhcp_network]
330
327
}
331
328
329
+ ### IP for LB IP
332
330
resource scaleway_lb_ip ip01 {
333
331
}
334
-
332
+
335
333
resource scaleway_lb lb01 {
336
334
ip_id = scaleway_lb_ip.ip01.id
337
335
name = "test-lb-with-private-network-configs"
338
336
type = "LB-S"
339
337
340
338
private_network {
341
- private_network_id = scaleway_vpc_private_network.static_network.id
342
- static_config = ["172.16.0.100", "172.16.0.101"]
343
- }
344
-
345
- private_network {
346
- private_network_id = scaleway_vpc_private_network.dhcp_network.id
339
+ private_network_id = scaleway_vpc_private_network.main.id
347
340
dhcp_config = true
348
341
}
349
342
@@ -353,18 +346,19 @@ func TestAccScalewayLbLb_WithSeveralPrivateNetworks(t *testing.T) {
353
346
Check : resource .ComposeTestCheckFunc (
354
347
testAccCheckScalewayLbExists (tt , "scaleway_lb.lb01" ),
355
348
testAccCheckScalewayLbIPExists (tt , "scaleway_lb_ip.ip01" ),
356
- resource .TestCheckResourceAttrSet ("scaleway_vpc_private_network.dhcp_network" , "name" ),
357
- resource .TestCheckResourceAttrSet ("scaleway_vpc_private_network.static_network" , "name" ),
358
- resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
359
- "private_network.0.static_config.0" , "172.16.0.100" ),
360
- resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
361
- "private_network.0.static_config.1" , "172.16.0.101" ),
349
+ resource .TestCheckResourceAttrSet ("scaleway_vpc_private_network.main" , "name" ),
350
+ resource .TestCheckResourceAttrPair (
351
+ "scaleway_lb.lb01" , "private_network.0.private_network_id" ,
352
+ "scaleway_vpc_private_network.main" , "id" ),
353
+ resource .TestCheckResourceAttrPair (
354
+ "scaleway_instance_server.main" , "private_network.0.pn_id" ,
355
+ "scaleway_vpc_private_network.main" , "id" ),
362
356
resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
363
357
"private_network.0.status" , lbSDK .PrivateNetworkStatusReady .String ()),
364
358
resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
365
- "private_network.1 .dhcp_config" , "true" ),
359
+ "private_network.0 .dhcp_config" , "true" ),
366
360
resource .TestCheckResourceAttr ("scaleway_lb.lb01" ,
367
- "private_network.1 .status" , lbSDK .PrivateNetworkStatusReady .String ()),
361
+ "private_network.0 .status" , lbSDK .PrivateNetworkStatusReady .String ()),
368
362
),
369
363
},
370
364
},
0 commit comments