Skip to content

Allow clearing all records on an internal data group - #132

Open
mdkent wants to merge 1 commit into
f5devcentral:masterfrom
basecamp:ltm-datagroup-empty-records
Open

Allow clearing all records on an internal data group#132
mdkent wants to merge 1 commit into
f5devcentral:masterfrom
basecamp:ltm-datagroup-empty-records

Conversation

@mdkent

@mdkent mdkent commented May 28, 2026

Copy link
Copy Markdown

Summary

  • dataGroupDTO.Records is currently tagged json:"records,omitempty". In Go, omitempty drops the field for both nil and []DataGroupRecord{}, so a PUT to /ltm/data-group/internal/{name} with an empty record set sends no records field at all — and BigIP keeps the existing records.
  • This change drops omitempty so callers can clear records on an existing data group by passing an empty slice ([]DataGroupRecord{} now serializes as "records": []).

Context

This mirrors the vendor-side patch shipped in the terraform-provider-bigip repo to fix F5Networks/terraform-provider-bigip#1164. See F5Networks/terraform-provider-bigip#1165. Landing this upstream means the next go mod vendor won't revert the fix.

Behavior change

  • Records: nil now serializes as "records": null instead of being omitted. Most callers should send []DataGroupRecord{} instead of nil when they mean "no records." The terraform provider PR makes this change on its side.
  • Records: []DataGroupRecord{} now serializes as "records": [] — which is what BigIP needs to actually clear records.

Test plan

The Records field on dataGroupDTO was tagged `json:"records,omitempty"`, so a PUT
with an empty record set sent no `records` field at all and BigIP kept the existing
entries. Drop omitempty so callers can clear records by passing an empty slice
(which now serializes as `"records": []`).

Mirrors the vendor patch in F5Networks/terraform-provider-bigip#1165.
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.

Can't delete all records in an existing bigip_ltm_datagroup

1 participant