Skip to content

feat(loadbalancer): add labels - #1827

Open
ibrahimyesilay wants to merge 1 commit into
stackitcloud:mainfrom
ibrahimyesilay:feat/loadbalancer-labels
Open

ibrahimyesilay wants to merge 1 commit into
stackitcloud:mainfrom
ibrahimyesilay:feat/loadbalancer-labels

Conversation

@ibrahimyesilay

Copy link
Copy Markdown

Description

relates to #1825

Adds labels to stackit_loadbalancer (resource and data source). The Network Load Balancer API already accepts labels on create and update (CreateLoadBalancerPayload.Labels, UpdateLoadBalancerPayload.Labels).

The schema and validators follow stackit_application_load_balancer, with two differences:

  • Label values may be empty (LengthBetween(0, 63)), as documented for the NLB API.
  • An empty label map returned by the API is mapped to null, so a configuration without labels does not end up with {} in state.

This is the second part of #1825; the health check options are in #1826. Both PRs touch the same files, so whichever is merged second will need a rebase — happy to do that.

Testing

  • Unit tests extended for toCreatePayload, toUpdatePayload and mapFields, plus a new Test_mapLabels.
  • TestAccLoadBalancerResourceMax extended with labels (create, data source and update step changing the label value) and run against a STACKIT project: PASS.
  • make fmt, make lint, make test, make generate-docs pass locally.
  • Not covered by a test: removing labels from an existing load balancer. The update call sends the full load balancer, so omitting labels should clear them, but I did not verify this against the API.

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)

The Network Load Balancer API supports user-defined labels on create and
update, but stackit_loadbalancer did not expose them.

Add `labels` to the resource and the data source, following
stackit_application_load_balancer. An empty label map returned by the API is
mapped to null, so a configuration without labels does not produce an
inconsistent result.

relates to stackitcloud#1825
@ibrahimyesilay
ibrahimyesilay requested a review from a team as a code owner October 16, 2026 19:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant