Skip to content

feat(loadbalancer): Service Plan support for Load Balancers #858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChristianHamm
Copy link
Contributor

Description

Added support for the plan_id field used to create or change a load balancer's plan to a higher one (e.g. p250, p750, ...).

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

…alancer's plan to a higher one (e.g. p250, p750, ...).
@@ -38,6 +38,7 @@ data "stackit_loadbalancer" "example" {
- `listeners` (Attributes List) List of all listeners which will accept traffic. Limited to 20. (see [below for nested schema](#nestedatt--listeners))
- `networks` (Attributes List) List of networks that listeners and targets reside in. (see [below for nested schema](#nestedatt--networks))
- `options` (Attributes) Defines any optional functionality you want to have enabled on your load balancer. (see [below for nested schema](#nestedatt--options))
- `plan_id` (String) The service plan ID. Defaults to p10. See the API docs for a list of available plans at: https://docs.api.stackit.cloud/documentation/load-balancer/version/v1#tag/APIService/operation/APIService_ListPlans
Copy link
Member

@rubenhoenle rubenhoenle May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `plan_id` (String) The service plan ID. Defaults to p10. See the API docs for a list of available plans at: https://docs.api.stackit.cloud/documentation/load-balancer/version/v1#tag/APIService/operation/APIService_ListPlans
- `plan_id` (String) The service plan ID. Defaults to `p10`. See the API docs for a list of available plans at: https://docs.api.stackit.cloud/documentation/load-balancer/version/v1#tag/APIService/operation/APIService_ListPlans

Don't know if it's good in terms of user-experience to let the users make an API call to get the list of available options. I would at least additionally add the STACKIT CLI command to fetch the list of available plans.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we could just provide the possible information directly, which would be p10, p50, p250 and p750.

Which do you prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also fine for me to define them here. We have a util func to format them properly, see the links below where to find it and how to use :)

@rubenhoenle
Copy link
Member

rubenhoenle commented May 23, 2025

Please also adjust the acceptance tests of of the loadbalancer resource and datasource: https://github.com/stackitcloud/terraform-provider-stackit/blob/main/stackit/internal/services/loadbalancer/loadbalancer_acc_test.go

Since the plan id is optional, it only add it to the max acc test resource please (for the datasource you can check the plan id for both, max and min) 😄

@@ -179,6 +179,149 @@ func TestToCreatePayload(t *testing.T) {
},
true,
},
{
"service_plan_ok",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just add the plan id to one of the existing test cases? Fells weird to duplicate so much code to test a single field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to test specifically my change to here. I can remove it if you like.

@@ -72,6 +72,7 @@ func (r *loadBalancerDataSource) Schema(_ context.Context, _ datasource.SchemaRe
"protocol": "Protocol is the highest network protocol we understand to load balance.",
"target_pool": "Reference target pool by target pool name.",
"name": "Load balancer name.",
"plan_id": "The service plan ID. Defaults to p10. See the API docs for a list of available plans at: https://docs.api.stackit.cloud/documentation/load-balancer/version/v1#tag/APIService/operation/APIService_ListPlans",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"plan_id": "The service plan ID. Defaults to p10. See the API docs for a list of available plans at: https://docs.api.stackit.cloud/documentation/load-balancer/version/v1#tag/APIService/operation/APIService_ListPlans",
"plan_id": "The service plan ID. See the API docs for a list of available plans at: https://docs.api.stackit.cloud/documentation/load-balancer/version/v1#tag/APIService/operation/APIService_ListPlans",

Datasource has no default value for this field.

@ChristianHamm
Copy link
Contributor Author

Please also adjust the acceptance tests of of the loadbalancer resource and datasource:

I saw that it was not part of the pipeline and it requires some sort of setup, which I do not have. I would kindly ask you to assist here please.

@ChristianHamm ChristianHamm requested a review from rubenhoenle May 30, 2025 06:43
Copy link

github-actions bot commented Jun 7, 2025

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants