Skip to content

feat(lbiplists): onboard lbiplists - #1788

Open
SerseusWasTaken wants to merge 2 commits into
mainfrom
feat/onboard-lb-ip-lists-resource
Open

SerseusWasTaken wants to merge 2 commits into
mainfrom
feat/onboard-lb-ip-lists-resource

Conversation

@SerseusWasTaken

@SerseusWasTaken SerseusWasTaken commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Onboards the new lbiplists service

Relates to STACKITTPR-864

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)

@SerseusWasTaken
SerseusWasTaken requested a review from a team as a code owner September 29, 2026 12:16
@SerseusWasTaken
SerseusWasTaken force-pushed the feat/onboard-lb-ip-lists-resource branch 2 times, most recently from 998b6e3 to 64477ee Compare September 29, 2026 12:24
Comment thread docs/data-sources/lb_ip_list.md Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/resource.go Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/datasource.go Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/datasource.go Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/datasource.go Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/datasource.go Outdated
Comment on lines +203 to +208
respLabels, _ := ipList.GetLabelsOk()
labels, err := utils.MapLabels(ctx, respLabels, model.Labels)
if err != nil {
return fmt.Errorf("mapping labels: %w", err)
}
model.Labels = labels

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can directly map the labels to the model. In the datasource the model will never have any labels set. It's just a simple mapping of api response to terraform state.

And you can use here directly the labels attribute ipList.Labels instead of using the GetOk function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah true, though we have a handful of datasources that use that helper as well.
I changed it to labels, err := types.MapValue(types.StringType, map[string]attr.Value{})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually no, i left it as it is. many other datasources use it as well and not using it just results in more boilerplate code - i dont see the benefit here

Comment thread stackit/internal/services/lbiplists/iplistsservice/datasource.go Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/resource.go Outdated
Comment thread stackit/internal/services/lbiplists/iplistsservice/resource.go Outdated
Comment thread docs/resources/lb_ip_list.md Outdated
Comment on lines +44 to +47
> **NOTE**: [Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments) are supported in Terraform 1.11 and later.

- `file_content` (String, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Raw upload payload as a plain UTF-8 string. Newline-separated .txt list of IPv4 CIDR entries, or CSV with cidr,labels columns (any other columns are ignored). Write-only - never stored in state and never returned by the API. To rotate the content, update this value AND increment file_content_version. Changing this field alone will NOT trigger an update.
- `file_content_version` (Number) User-managed rotation counter for the file_content. Must be incremented every time file_content is changed. Terraform diffs this field to detect changes in the defined IP list - changing file_content alone will NOT trigger an update because it is write-only and never stored in state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could also do this a bit different. Instead of using the write-only attribute, we could save the file_content directly to the state. Then we can calculate the hash locally and compare it with the hash from the API, if they are not equal, we can set the file_content to an null string, to trigger an update. For this approach we would need to know, how the Service calculates the hash, to calculate it the same. But I think this provides a better user exerience.

We can discuss it also in a private chat.

Comment thread stackit/internal/services/lbiplists/utils/util.go Outdated
Relates to STACKITTPR-864
@SerseusWasTaken
SerseusWasTaken force-pushed the feat/onboard-lb-ip-lists-resource branch from f180c2c to b2df37a Compare October 1, 2026 06:35
@SerseusWasTaken
SerseusWasTaken force-pushed the feat/onboard-lb-ip-lists-resource branch from b2df37a to b6e5bc1 Compare October 1, 2026 06:41
@@ -0,0 +1,35 @@
---

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't forget to adjust the labeler config so future contributions for this integration get labelled automatically :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants