Skip to content

Commit

Permalink
disables LDAP in Delete
Browse files Browse the repository at this point in the history
  • Loading branch information
lantoli committed Apr 29, 2024
1 parent 8ae5176 commit 37a5a4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/2221.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/mongodbatlas_ldap_configuration: Disables LDAP when the resource is destroyed, instead of deleting userToDNMapping document
```
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.

func resourceDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
connV2 := meta.(*config.MongoDBClient).AtlasV2
_, _, err := connV2.LDAPConfigurationApi.DeleteLDAPConfiguration(ctx, d.Id()).Execute()
params := &admin.UserSecurity{
Ldap: &admin.LDAPSecuritySettings{
AuthenticationEnabled: conversion.Pointer(false),
AuthorizationEnabled: conversion.Pointer(false),
},
}
_, _, err := connV2.LDAPConfigurationApi.SaveLDAPConfiguration(ctx, d.Id(), params).Execute()
if err != nil {
return diag.FromErr(fmt.Errorf(errorDelete, d.Id(), err))
}
Expand Down

0 comments on commit 37a5a4a

Please sign in to comment.