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) }