Skip to content

Commit

Permalink
INTMDB-310: Potential bug when disabling auditing (#705)
Browse files Browse the repository at this point in the history
* Add support for proper destroy of Auditing settings

* Remove whitespace
  • Loading branch information
martinstibbe authored Apr 24, 2022
1 parent 778064b commit 3f4615e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mongodbatlas/resource_mongodbatlas_auditing.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ func resourceMongoDBAtlasAuditingUpdate(ctx context.Context, d *schema.ResourceD
}

func resourceMongoDBAtlasAuditingDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
// Get the client connection.
conn := meta.(*MongoDBClient).Atlas

auditingReq := &matlas.Auditing{}

auditingReq.Enabled = pointy.Bool(false)

_, _, err := conn.Auditing.Configure(ctx, d.Id(), auditingReq)
if err != nil {
return diag.FromErr(fmt.Errorf(errorAuditingUpdate, d.Id(), err))
}

d.SetId("")

return nil
Expand Down

0 comments on commit 3f4615e

Please sign in to comment.