terraform-provider-databricks icon indicating copy to clipboard operation
terraform-provider-databricks copied to clipboard

[Fix] Fix issue with case sensitive group names in `databricks_group` resource

Open Joe-Koch opened this issue 1 year ago • 3 comments
trafficstars

  • 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 test run locally
  • [X] relevant change in docs/ folder
  • [ ] covered with integration tests in internal/acceptance
  • [ ] relevant acceptance tests are passing
  • [ ] using Go SDK

Joe-Koch avatar May 21 '24 01:05 Joe-Koch

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

Impacted file tree graph

@@           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:

... and 1 file with indirect coverage changes

codecov-commenter avatar May 21 '24 07:05 codecov-commenter

@tanmay-db Is there anything else needed to get this approved? Thank you

Joe-Koch avatar Jun 21 '24 03:06 Joe-Koch

Hi @Joe-Koch, thanks for the PR. I will take a look and reach back to you.

tanmay-db avatar Jul 02 '24 12:07 tanmay-db