From f73f18118fd44af8b6305112861d1f4dcef6455d Mon Sep 17 00:00:00 2001 From: abhi99shek99 Date: Tue, 6 Oct 2026 12:43:42 +0530 Subject: [PATCH] Supress group name case sensitive matching (#838) * Supress group name case sensitive matching * Moved DiffSuppressFunc onto the string Elem schema so it's applied per-element instead of the list itself * Updated the test as per the new recent changes made in the main branch * review changes --------- Co-authored-by: Abhishek Singh Tanwar --- internal/provider/resource_managed_group_ldap.go | 4 ++++ .../provider/resource_managed_group_ldap_test.go | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/internal/provider/resource_managed_group_ldap.go b/internal/provider/resource_managed_group_ldap.go index b7496d2a..c5ea1a17 100644 --- a/internal/provider/resource_managed_group_ldap.go +++ b/internal/provider/resource_managed_group_ldap.go @@ -6,6 +6,7 @@ package provider import ( "context" "net/http" + "strings" "github.com/hashicorp/boundary/api" "github.com/hashicorp/boundary/api/managedgroups" @@ -56,6 +57,9 @@ func resourceManagedGroupLdap() *schema.Resource { Type: schema.TypeString, }, Required: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return strings.EqualFold(old, new) + }, }, }, } diff --git a/internal/provider/resource_managed_group_ldap_test.go b/internal/provider/resource_managed_group_ldap_test.go index d04c85c4..dffcf4fe 100644 --- a/internal/provider/resource_managed_group_ldap_test.go +++ b/internal/provider/resource_managed_group_ldap_test.go @@ -26,6 +26,14 @@ resource "boundary_managed_group_ldap" "foo" { group_names = ["admin", "users"] }`, managedGroupName, managedGroupDescription) + fooManagedGroupLdapCaseInsensitive = fmt.Sprintf(` +resource "boundary_managed_group_ldap" "foo" { + name = "%s" + description = "%s" + auth_method_id = boundary_auth_method_ldap.test-ldap.id + group_names = ["ADMIN", "USERS"] +}`, managedGroupName, managedGroupDescription) + fooManagedGroupLdapUpdate = fmt.Sprintf(` resource "boundary_managed_group_ldap" "foo" { name = "%s" @@ -59,6 +67,11 @@ func TestAccManagedGroupLdap(t *testing.T) { ), }, importStep("boundary_managed_group_ldap.foo"), + { + // group_names should ignore case-only diffs + PlanOnly: true, + Config: testConfig(url, fooOrg(suffix), createConfig, fooManagedGroupLdapCaseInsensitive), + }, { // test update Config: testConfig(url, fooOrg(suffix), createConfig, fooManagedGroupLdapUpdate),