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 <abhishek_ibm@dhcp-9-127-1-123.c4p-in.ibm.com>
This commit is contained in:
1 parent
c9aee30331
commit
f73f18118f
2 files changed
+17
No files matched your search
@@ -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)
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user