@@ -5,6 +5,7 @@ package power
55
66import (
77 "context"
8+ "fmt"
89 "log"
910
1011 "github.com/IBM-Cloud/power-go-client/clients/instance"
@@ -105,18 +106,22 @@ func DataSourceIBMPIRoutes() *schema.Resource {
105106 }
106107}
107108
108- func dataSourceIBMPIRoutesRead (ctx context.Context , d * schema.ResourceData , meta interface {} ) diag.Diagnostics {
109+ func dataSourceIBMPIRoutesRead (ctx context.Context , d * schema.ResourceData , meta any ) diag.Diagnostics {
109110 sess , err := meta .(conns.ClientSession ).IBMPISession ()
110111 if err != nil {
111- return diag .FromErr (err )
112+ tfErr := flex .TerraformErrorf (err , fmt .Sprintf ("IBMPISession failed: %s" , err .Error ()), "(Data) ibm_pi_routes" , "read" )
113+ log .Printf ("[DEBUG]\n %s" , tfErr .GetDebugMessage ())
114+ return tfErr .GetDiag ()
112115 }
113116
114117 cloudInstanceID := d .Get (Arg_CloudInstanceID ).(string )
115118 client := instance .NewIBMPIRouteClient (ctx , sess , cloudInstanceID )
116119
117120 routes , err := client .GetAll ()
118121 if err != nil {
119- return diag .FromErr (err )
122+ tfErr := flex .TerraformErrorf (err , fmt .Sprintf ("GetAll failed: %s" , err .Error ()), "(Data) ibm_pi_routes" , "read" )
123+ log .Printf ("[DEBUG]\n %s" , tfErr .GetDebugMessage ())
124+ return tfErr .GetDiag ()
120125 }
121126 var clientgenU , _ = uuid .GenerateUUID ()
122127 d .SetId (clientgenU )
@@ -125,10 +130,10 @@ func dataSourceIBMPIRoutesRead(ctx context.Context, d *schema.ResourceData, meta
125130 return nil
126131}
127132
128- func flattenRoutes (routes []* models.Route , meta interface {} ) []map [string ]interface {} {
129- result := make ([]map [string ]interface {} , len (routes ))
133+ func flattenRoutes (routes []* models.Route , meta any ) []map [string ]any {
134+ result := make ([]map [string ]any , len (routes ))
130135 for _ , r := range routes {
131- route := map [string ]interface {} {
136+ route := map [string ]any {
132137 Attr_RouteID : r .ID ,
133138 Attr_Action : r .Action ,
134139 Attr_Advertise : r .Advertise ,
0 commit comments