@@ -3,8 +3,6 @@ package lb
33import (
44 "context"
55 "fmt"
6- ipamAPI "github.com/scaleway/scaleway-sdk-go/api/ipam/v1"
7- "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/ipam"
86 "net"
97 "strings"
108 "time"
@@ -13,6 +11,7 @@ import (
1311 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1412 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
1513 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
14+ ipamAPI "github.com/scaleway/scaleway-sdk-go/api/ipam/v1"
1615 lbSDK "github.com/scaleway/scaleway-sdk-go/api/lb/v1"
1716 "github.com/scaleway/scaleway-sdk-go/scw"
1817 "github.com/scaleway/terraform-provider-scaleway/v2/internal/cdf"
@@ -22,6 +21,7 @@ import (
2221 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional"
2322 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
2423 "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
24+ "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/ipam"
2525 "github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
2626 "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
2727)
@@ -360,17 +360,20 @@ func resourceLbRead(ctx context.Context, d *schema.ResourceData, m interface{})
360360 privateNetworkIDs = append (privateNetworkIDs , pn .PrivateNetworkID )
361361 }
362362
363- var allPrivateIPs []map [string ]interface {}
363+ allPrivateIPs := []map [string ]interface {}( nil )
364364 resourceType := ipamAPI .ResourceTypeLBServer
365+
365366 for _ , privateNetworkID := range privateNetworkIDs {
366367 opts := & ipam.GetResourcePrivateIPsOptions {
367368 ResourceType : & resourceType ,
368369 PrivateNetworkID : & privateNetworkID ,
369370 }
371+
370372 privateIPs , err := ipam .GetResourcePrivateIPs (ctx , m , region , opts )
371373 if err != nil {
372374 return diag .FromErr (err )
373375 }
376+
374377 if privateIPs != nil {
375378 allPrivateIPs = append (allPrivateIPs , privateIPs ... )
376379 }
0 commit comments