feat(loadbalancer): support service plan attribute (#858)

relates to STACKITLB-250

Co-authored-by: Christian Hamm <Christian.Hamm@mail.schwarz>
Co-authored-by: Ruben Hönle <git@hoenle.xyz>
This commit is contained in:
Christian Hamm 2025-07-15 16:09:42 +02:00 committed by GitHub
parent 3255f1e28d
commit ab232d6cb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 174 additions and 0 deletions

View file

@ -62,6 +62,8 @@ func (r *loadBalancerDataSource) Configure(ctx context.Context, req datasource.C
// Schema defines the schema for the data source.
func (r *loadBalancerDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
servicePlanOptions := []string{"p10", "p50", "p250", "p750"}
descriptions := map[string]string{
"main": "Load Balancer data source schema. Must have a `region` specified in the provider configuration.",
"id": "Terraform's internal resource ID. It is structured as \"`project_id`\",\"region\",\"`name`\".",
@ -72,6 +74,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. If not defined, the default service plan is `p10`. " + utils.FormatPossibleValues(servicePlanOptions...),
"networks": "List of networks that listeners and targets reside in.",
"network_id": "Openstack network ID.",
"role": "The role defines how the load balancer is using the network.",
@ -122,6 +125,10 @@ func (r *loadBalancerDataSource) Schema(_ context.Context, _ datasource.SchemaRe
Description: descriptions["external_address"],
Computed: true,
},
"plan_id": schema.StringAttribute{
Description: descriptions["plan_id"],
Computed: true,
},
"listeners": schema.ListNestedAttribute{
Description: descriptions["listeners"],
Computed: true,