@@ -460,6 +460,72 @@ func TestAccLB_WithPrivateNetworksOnDHCPConfig(t *testing.T) {
460
460
})
461
461
}
462
462
463
+ func TestAccLB_WithPrivateNetworksIPAMIDs (t * testing.T ) {
464
+ tt := acctest .NewTestTools (t )
465
+ defer tt .Cleanup ()
466
+ resource .ParallelTest (t , resource.TestCase {
467
+ PreCheck : func () { acctest .PreCheck (t ) },
468
+ ProviderFactories : tt .ProviderFactories ,
469
+ CheckDestroy : resource .ComposeTestCheckFunc (
470
+ isLbDestroyed (tt ),
471
+ vpcchecks .CheckPrivateNetworkDestroy (tt ),
472
+ ),
473
+ Steps : []resource.TestStep {
474
+ {
475
+ Config : `
476
+ resource "scaleway_vpc" "vpc01" {
477
+ name = "my vpc"
478
+ }
479
+
480
+ resource "scaleway_vpc_private_network" "pn01" {
481
+ vpc_id = scaleway_vpc.vpc01.id
482
+ ipv4_subnet {
483
+ subnet = "172.16.32.0/22"
484
+ }
485
+ }
486
+
487
+ resource "scaleway_ipam_ip" "ip01" {
488
+ address = "172.16.32.7"
489
+ source {
490
+ private_network_id = scaleway_vpc_private_network.pn01.id
491
+ }
492
+ }
493
+
494
+ resource scaleway_lb lb01 {
495
+ name = "test-lb-with-private-network-ipam"
496
+ type = "LB-S"
497
+
498
+ private_network {
499
+ private_network_id = scaleway_vpc_private_network.pn01.id
500
+ ipam_ids = [scaleway_ipam_ip.ip01.id]
501
+ }
502
+ }
503
+
504
+ data "scaleway_ipam_ip" "by_name" {
505
+ resource {
506
+ name = scaleway_lb.lb01.name
507
+ type = "lb_server"
508
+ }
509
+ type = "ipv4"
510
+ }
511
+ ` ,
512
+ Check : resource .ComposeTestCheckFunc (
513
+ isLbPresent (tt , "scaleway_lb.lb01" ),
514
+ resource .TestCheckResourceAttrPair (
515
+ "scaleway_lb.lb01" , "private_network.0.private_network_id" ,
516
+ "scaleway_vpc_private_network.pn01" , "id" ),
517
+ resource .TestCheckResourceAttrPair (
518
+ "scaleway_lb.lb01" , "private_network.0.ipam_ids.0" ,
519
+ "scaleway_ipam_ip.ip01" , "id" ),
520
+ resource .TestCheckResourceAttrPair (
521
+ "scaleway_ipam_ip.ip01" , "address" ,
522
+ "data.scaleway_ipam_ip.by_name" , "address_cidr" ),
523
+ ),
524
+ },
525
+ },
526
+ })
527
+ }
528
+
463
529
func TestAccLB_WithoutPNConfig (t * testing.T ) {
464
530
tt := acctest .NewTestTools (t )
465
531
defer tt .Cleanup ()
0 commit comments