-
Notifications
You must be signed in to change notification settings - Fork 26
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
base: main
Are you sure you want to change the base?
feat(loadbalancer): Service Plan support for Load Balancers #858
Conversation
…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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
return fmt.Sprintf("Possible values are: %s.", strings.Join(formattedValues, ", ")) terraform-provider-stackit/stackit/internal/services/iaas/securitygrouprule/resource.go
Line 336 in b313ef6
Description: fmt.Sprintf("The protocol name which the rule should match. Either `name` or `number` must be provided. %s", utils.FormatPossibleValues(protocolsPossibleValues)),
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", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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.
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. |
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. |
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
make fmt
examples/
directory)make generate-docs
(will be checked by CI)make test
(will be checked by CI)make lint
(will be checked by CI)