From 6d46e17fd28bc3767bee607349f62dbe80ab6950 Mon Sep 17 00:00:00 2001 From: Pablo RUTH Date: Thu, 30 Mar 2023 12:09:30 +0200 Subject: [PATCH] nameAttr from ou attribute instead of non checked name attribute --- ldap/resource_ldap_ou.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldap/resource_ldap_ou.go b/ldap/resource_ldap_ou.go index 4131e34..70a8434 100644 --- a/ldap/resource_ldap_ou.go +++ b/ldap/resource_ldap_ou.go @@ -103,7 +103,7 @@ func resourceLDAPOURead(ctx context.Context, d *schema.ResourceData, m interface } // Remove the `OU=,` from the DN to get the OU - ou := strings.ReplaceAll(dn, fmt.Sprintf("OU=%s,", attributes["name"][0]), "") + ou := strings.Replace(dn, fmt.Sprintf("OU=%s,", nameAttr[0]), "", 1) if err := d.Set("ou", ou); err != nil { return diag.FromErr(err) }