@@ -13,7 +13,8 @@ import (
1313 "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
1414 "github.com/hashicorp/terraform-plugin-framework/types"
1515 "github.com/hashicorp/terraform-plugin-log/tflog"
16- albSdk "github.com/stackitcloud/stackit-sdk-go/services/alb"
16+ legacyAlb "github.com/stackitcloud/stackit-sdk-go/services/alb"
17+ albSdk "github.com/stackitcloud/stackit-sdk-go/services/alb/v2api"
1718 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
1819 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
1920)
@@ -57,9 +58,9 @@ func (r *albDataSource) Configure(ctx context.Context, req datasource.ConfigureR
5758
5859// Schema defines the schema for the resource.
5960func (r * albDataSource ) Schema (_ context.Context , _ datasource.SchemaRequest , resp * datasource.SchemaResponse ) {
60- protocolOptions := sdkUtils .EnumSliceToStringSlice (albSdk .AllowedListenerProtocolEnumValues )
61- roleOptions := sdkUtils .EnumSliceToStringSlice (albSdk .AllowedNetworkRoleEnumValues )
62- errorOptions := sdkUtils .EnumSliceToStringSlice (albSdk .AllowedLoadBalancerErrorTypesEnumValues )
61+ protocolOptions := sdkUtils .EnumSliceToStringSlice (legacyAlb .AllowedListenerProtocolEnumValues )
62+ roleOptions := sdkUtils .EnumSliceToStringSlice (legacyAlb .AllowedNetworkRoleEnumValues )
63+ errorOptions := sdkUtils .EnumSliceToStringSlice (legacyAlb .AllowedLoadBalancerErrorTypesEnumValues )
6364
6465 descriptions := map [string ]string {
6566 "main" : "Application Load Balancer resource schema." ,
@@ -201,7 +202,7 @@ func (r *albDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, re
201202 Description : descriptions ["listeners.name" ],
202203 Computed : true ,
203204 },
204- "port" : schema.Int64Attribute {
205+ "port" : schema.Int32Attribute {
205206 Description : descriptions ["port" ],
206207 Computed : true ,
207208 },
@@ -433,7 +434,7 @@ func (r *albDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, re
433434 Description : descriptions ["active_health_check" ],
434435 Computed : true ,
435436 Attributes : map [string ]schema.Attribute {
436- "healthy_threshold" : schema.Int64Attribute {
437+ "healthy_threshold" : schema.Int32Attribute {
437438 Description : descriptions ["healthy_threshold" ],
438439 Computed : true ,
439440 },
@@ -449,7 +450,7 @@ func (r *albDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, re
449450 Description : descriptions ["timeout" ],
450451 Computed : true ,
451452 },
452- "unhealthy_threshold" : schema.Int64Attribute {
453+ "unhealthy_threshold" : schema.Int32Attribute {
453454 Description : descriptions ["unhealthy_threshold" ],
454455 Computed : true ,
455456 },
@@ -474,7 +475,7 @@ func (r *albDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, re
474475 Description : descriptions ["target_pools.name" ],
475476 Computed : true ,
476477 },
477- "target_port" : schema.Int64Attribute {
478+ "target_port" : schema.Int32Attribute {
478479 Description : descriptions ["target_port" ],
479480 Computed : true ,
480481 },
@@ -555,7 +556,7 @@ func (r *albDataSource) Read(ctx context.Context, req datasource.ReadRequest, re
555556 ctx = tflog .SetField (ctx , "name" , name )
556557 ctx = tflog .SetField (ctx , "region" , region )
557558
558- albResp , err := r .client .GetLoadBalancer (ctx , projectId , region , name ).Execute ()
559+ albResp , err := r .client .DefaultAPI . GetLoadBalancer (ctx , projectId , region , name ).Execute ()
559560 if err != nil {
560561 utils .LogError (
561562 ctx ,
0 commit comments