-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Fix issue with case sensitive group names in databricks_group
resource
#3597
base: main
Are you sure you want to change the base?
[Fix] Fix issue with case sensitive group names in databricks_group
resource
#3597
Conversation
- 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.
Codecov ReportAttention: Patch coverage is
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
|
@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. |
databricks_group
resourcedatabricks_group
resource
@@ -59,7 +59,18 @@ func (a GroupsAPI) ReadByDisplayName(displayName, attributes string) (group Grou | |||
err = fmt.Errorf("cannot find group: %s", displayName) | |||
return | |||
} | |||
group = groupList.Resources[0] | |||
if len(groupList.Resources) == 1 { | |||
group = groupList.Resources[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we enforce case-sensitive names here as well?
databricks_group
resource #3596, issue with case sensitive group names in databricks_group resourceChanges
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.make test
run locallydocs/
folderinternal/acceptance