From 61b33786b0488ceaae9bf3c8009b8a9d7221bc4a Mon Sep 17 00:00:00 2001 From: Ruben Aleman Date: Mon, 23 Mar 2026 12:55:23 +0100 Subject: [PATCH] feat(edgecloud): add minEdgeHosts attribute to plans data source --- docs/data-sources/edgecloud_plans.md | 1 + go.mod | 2 +- go.sum | 4 ++-- stackit/internal/services/edgecloud/edge_acc_test.go | 2 ++ stackit/internal/services/edgecloud/plans/datasource.go | 8 +++++++- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/data-sources/edgecloud_plans.md b/docs/data-sources/edgecloud_plans.md index dc44765b2..31714d344 100644 --- a/docs/data-sources/edgecloud_plans.md +++ b/docs/data-sources/edgecloud_plans.md @@ -43,4 +43,5 @@ Read-Only: - `description` (String) Description of the plan. - `id` (String) The ID of the plan. - `max_edge_hosts` (Number) Maximum number of Edge Cloud hosts that can be used. +- `min_edge_hosts` (Number) Minimum number of Edge Cloud hosts charged. - `name` (String) The name of the plan. diff --git a/go.mod b/go.mod index f4f9ed896..f2182b747 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/stackitcloud/stackit-sdk-go/services/alb v0.9.3 github.com/stackitcloud/stackit-sdk-go/services/cdn v1.13.0 github.com/stackitcloud/stackit-sdk-go/services/dns v0.19.1 - github.com/stackitcloud/stackit-sdk-go/services/edge v0.4.3 + github.com/stackitcloud/stackit-sdk-go/services/edge v0.7.0 github.com/stackitcloud/stackit-sdk-go/services/git v0.10.3 github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 github.com/stackitcloud/stackit-sdk-go/services/kms v1.3.2 diff --git a/go.sum b/go.sum index 4ee8b4056..ac1a4ccea 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,8 @@ github.com/stackitcloud/stackit-sdk-go/services/cdn v1.13.0 h1:iRJK2d3I2QqWp8hqh github.com/stackitcloud/stackit-sdk-go/services/cdn v1.13.0/go.mod h1:URWWMIbvq4YgWdGYCbccr3eat4Y+0qRpufZsEAsvoLM= github.com/stackitcloud/stackit-sdk-go/services/dns v0.19.1 h1:VfszhFq/Snsd0LnflS8PbM0d9cG98hOFpamfjlcTnDQ= github.com/stackitcloud/stackit-sdk-go/services/dns v0.19.1/go.mod h1:gBv6YkB3Xf3c0ZXg2GwtWY8zExwGPF/Ag114XiiERxg= -github.com/stackitcloud/stackit-sdk-go/services/edge v0.4.3 h1:TxChb2qbO82JiQEBYClSSD5HZxqKeKJ6dIvkEUCJmbs= -github.com/stackitcloud/stackit-sdk-go/services/edge v0.4.3/go.mod h1:KVWvQHb7CQLD9DzA4Np3WmakiCCsrHaCXvFEnOQ7nPk= +github.com/stackitcloud/stackit-sdk-go/services/edge v0.7.0 h1:DNBiHWQEWXHSbaZBmnXb+CaPXX1uVsSfp4FTHoH4wrM= +github.com/stackitcloud/stackit-sdk-go/services/edge v0.7.0/go.mod h1:CfqSEGCW0b5JlijCwtUT1kfjThmQ5jXX47TWrdD5rTU= github.com/stackitcloud/stackit-sdk-go/services/git v0.10.3 h1:VIjkSofZz9utOOkBdNZCIb07P/JdKc1kHV1P8Rq9dLc= github.com/stackitcloud/stackit-sdk-go/services/git v0.10.3/go.mod h1:EJk1Ss9GTel2NPIu/w3+x9XcQcEd2k3ibea5aQDzVhQ= github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 h1:W57+XRa8wTLsi5CV9Tqa7mGgt/PvlRM//RurXSmvII8= diff --git a/stackit/internal/services/edgecloud/edge_acc_test.go b/stackit/internal/services/edgecloud/edge_acc_test.go index ac5f54ebd..430912ccb 100644 --- a/stackit/internal/services/edgecloud/edge_acc_test.go +++ b/stackit/internal/services/edgecloud/edge_acc_test.go @@ -174,6 +174,8 @@ func TestAccEdgeCloudMax(t *testing.T) { // check plans data source resource.TestCheckResourceAttr("data.stackit_edgecloud_plans.this", "id", testutil.ProjectId), resource.TestCheckResourceAttr("data.stackit_edgecloud_plans.this", "project_id", testutil.ProjectId), + resource.TestCheckResourceAttrSet("data.stackit_edgecloud_plans.this", "plans.0.min_edge_hosts"), + resource.TestCheckResourceAttrSet("data.stackit_edgecloud_plans.this", "plans.0.max_edge_hosts"), ), }, // Kubeconfig diff --git a/stackit/internal/services/edgecloud/plans/datasource.go b/stackit/internal/services/edgecloud/plans/datasource.go index a4f43d298..34ca59019 100644 --- a/stackit/internal/services/edgecloud/plans/datasource.go +++ b/stackit/internal/services/edgecloud/plans/datasource.go @@ -37,6 +37,7 @@ var planTypes = map[string]attr.Type{ "id": types.StringType, "name": types.StringType, "description": types.StringType, + "min_edge_hosts": types.Int64Type, "max_edge_hosts": types.Int64Type, } @@ -108,6 +109,10 @@ func (d *plansDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, Description: "Description of the plan.", Computed: true, }, + "min_edge_hosts": schema.Int64Attribute{ + Description: "Minimum number of Edge Cloud hosts charged.", + Computed: true, + }, "max_edge_hosts": schema.Int64Attribute{ Description: "Maximum number of Edge Cloud hosts that can be used.", Computed: true, @@ -190,7 +195,7 @@ func (d *plansDataSource) Read(ctx context.Context, req datasource.ReadRequest, // mapPlanToAttrs maps a single edge.Plan to a map of Terraform attributes. func mapPlanToAttrs(plan *edge.Plan) (map[string]attr.Value, error) { - if plan == nil || plan.Id == nil || plan.Name == nil || plan.MaxEdgeHosts == nil { + if plan == nil || plan.Id == nil || plan.Name == nil || plan.MaxEdgeHosts == nil || plan.MinEdgeHosts == nil { return nil, fmt.Errorf("received nil or incomplete plan from API") } @@ -198,6 +203,7 @@ func mapPlanToAttrs(plan *edge.Plan) (map[string]attr.Value, error) { "id": types.StringValue(plan.GetId()), "name": types.StringValue(plan.GetName()), "description": types.StringValue(plan.GetDescription()), + "min_edge_hosts": types.Int64Value(plan.GetMinEdgeHosts()), "max_edge_hosts": types.Int64Value(plan.GetMaxEdgeHosts()), }