@@ -13,6 +13,7 @@ import (
1313 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
1414 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional"
1515 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
16+ "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/ipam"
1617 "github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
1718 "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
1819)
@@ -192,6 +193,11 @@ func ResourcePool() *schema.Resource {
192193 Computed : true ,
193194 Elem : & schema.Resource {
194195 Schema : map [string ]* schema.Schema {
196+ "id" : {
197+ Type : schema .TypeString ,
198+ Computed : true ,
199+ Description : "The ID of the node" ,
200+ },
195201 "name" : {
196202 Type : schema .TypeString ,
197203 Computed : true ,
@@ -222,6 +228,25 @@ func ResourcePool() *schema.Resource {
222228 Computed : true ,
223229 Description : "The status of the pool" ,
224230 },
231+ "private_ips" : {
232+ Type : schema .TypeList ,
233+ Computed : true ,
234+ Description : "List of private IPv4 addresses associated with the resource" ,
235+ Elem : & schema.Resource {
236+ Schema : map [string ]* schema.Schema {
237+ "id" : {
238+ Type : schema .TypeString ,
239+ Computed : true ,
240+ Description : "The ID of the IPv4 address resource" ,
241+ },
242+ "address" : {
243+ Type : schema .TypeString ,
244+ Computed : true ,
245+ Description : "The private IPv4 address" ,
246+ },
247+ },
248+ },
249+ },
225250 },
226251 }
227252}
@@ -401,6 +426,35 @@ func ResourceK8SPoolRead(ctx context.Context, d *schema.ResourceData, m interfac
401426 _ = d .Set ("placement_group_id" , zonal .NewID (pool .Zone , * pool .PlacementGroupID ).String ())
402427 }
403428
429+ var allPrivateIPs []map [string ]interface {}
430+
431+ for _ , nodeMap := range nodes {
432+ nodeNameInterface , ok := nodeMap ["name" ]
433+ if ! ok {
434+ continue
435+ }
436+
437+ nodeName , ok := nodeNameInterface .(string )
438+ if ! ok {
439+ continue
440+ }
441+
442+ opts := & ipam.GetResourcePrivateIPsOptions {
443+ ResourceName : & nodeName ,
444+ }
445+
446+ privateIPs , err := ipam .GetResourcePrivateIPs (ctx , m , region , opts )
447+ if err != nil {
448+ return diag .FromErr (err )
449+ }
450+
451+ if privateIPs != nil {
452+ allPrivateIPs = append (allPrivateIPs , privateIPs ... )
453+ }
454+ }
455+
456+ _ = d .Set ("private_ips" , allPrivateIPs )
457+
404458 return nil
405459}
406460
0 commit comments