terraform-provider-databricks
terraform-provider-databricks copied to clipboard
[Fix] Fix issue with case sensitive group names in `databricks_group` resource
- Fixes Issue #3596, issue with case sensitive group names in databricks_group resource
- Updated ReadByDisplayName function to ensure exact case-sensitive matching of group display names.
- This addresses the issue where groups with similar names but different cases were not correctly distinguished.
Changes
Databricks enforces uniqueness of group names with case sensitivity, so groups like "Admins" and "admins" can exist in the same workspace. When you filter for Databricks groups matching a name with the SCIM API, the name match is not case-sensitive, and it might return multiple groups. The current code just grabs the first group from the results when multiple groups are returned. With this code change, if the length of the returned group list is greater than 1, it loops through the returned groups and searches for a match on DisplayName.
Tests
Added a test in groups_test.go to check that when there's a lower-case "name" group and an upper-case "Name" group, ReadByDisplayName will return the right one.
- [X]
make testrun locally - [X] relevant change in
docs/folder - [ ] covered with integration tests in
internal/acceptance - [ ] relevant acceptance tests are passing
- [ ] using Go SDK
Codecov Report
Attention: Patch coverage is 87.50000% with 1 lines in your changes are missing coverage. Please review.
Project coverage is 82.34%. Comparing base (
93f131c) to head (f708760).
Additional details and impacted files
@@ Coverage Diff @@
## main #3597 +/- ##
=======================================
Coverage 82.34% 82.34%
=======================================
Files 190 190
Lines 19323 19330 +7
=======================================
+ Hits 15911 15918 +7
- Misses 2480 2481 +1
+ Partials 932 931 -1
| Files | Coverage Δ | |
|---|---|---|
| scim/groups.go | 91.80% <87.50%> (-2.65%) |
:arrow_down: |
@tanmay-db Is there anything else needed to get this approved? Thank you
Hi @Joe-Koch, thanks for the PR. I will take a look and reach back to you.