Skip to content

Fix handling of empty except set#1581

Merged
tobio merged 2 commits intomainfrom
empty-except
Dec 22, 2025
Merged

Fix handling of empty except set#1581
tobio merged 2 commits intomainfrom
empty-except

Conversation

@tobio
Copy link
Member

@tobio tobio commented Dec 22, 2025

Fixes #1565

@tobio tobio requested a review from dimuon December 22, 2025 01:54
@tobio tobio self-assigned this Dec 22, 2025
Copilot AI review requested due to automatic review settings December 22, 2025 01:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in the handling of empty except sets in the Elasticsearch security role resource's field security configuration. The issue occurred when the API returned a null except field, which was incorrectly converted to a null set instead of an empty set, causing drift detection problems in Terraform.

Key Changes:

  • Wrap field security grant and except slices with utils.NonNilSlice() to ensure consistent empty set handling
  • Add test coverage for empty except sets in field security configuration

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/elasticsearch/security/role/models.go Added utils.NonNilSlice() wrapper to both grant and except field conversions to ensure nil slices are converted to empty slices before set creation
internal/elasticsearch/security/role/testdata/TestAccResourceSecurityRoleEmptySets/create/main.tf Added explicit empty except = [] configuration to test empty set handling

@tobio tobio merged commit c46c4da into main Dec 22, 2025
29 checks passed
@tobio tobio deleted the empty-except branch December 22, 2025 10:46
tobio added a commit that referenced this pull request Dec 23, 2025
* origin/main:
  chore(deps): update kibana-openapi-spec digest to 7d69aeb (#1582)
  Fix handling of empty except set (#1581)
  Limit dashboards acc tests to 9.3 (#1566)
  chore(deps): update kibana-openapi-spec digest to 7648954 (#1578)
  chore(deps): update kibana-openapi-spec digest to bdb1d87 (#1577)
  chore(deps): update kibana-openapi-spec digest to fce45e2 (#1571)
  chore(deps): update docker.elastic.co/elasticsearch/elasticsearch docker tag to v9.2.3 (#1573)
  chore(deps): update docker.elastic.co/kibana/kibana docker tag to v9.2.3 (#1574)
  fix(deps): update module github.com/go-resty/resty/v2 to v2.17.1 (#1554)
  fix(ml): anomaly_detection_job import/refresh mismatch (#1550)
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.

[Bug] Provider produced inconsistent result after apply in elasticsearch_security_role.role

3 participants