From 75e33c74ff4c4f9405372103afa85b4f311c7622 Mon Sep 17 00:00:00 2001 From: admin <33664051+martinstibbe@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:14:56 -0500 Subject: [PATCH 1/2] Add support for proper destroy of Auditing settings --- mongodbatlas/resource_mongodbatlas_auditing.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mongodbatlas/resource_mongodbatlas_auditing.go b/mongodbatlas/resource_mongodbatlas_auditing.go index f450043a45..0357e8f8ee 100644 --- a/mongodbatlas/resource_mongodbatlas_auditing.go +++ b/mongodbatlas/resource_mongodbatlas_auditing.go @@ -141,6 +141,19 @@ 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 From 56bbd394f66d6c797ccc7106309a7a632e18b7ee Mon Sep 17 00:00:00 2001 From: admin <33664051+martinstibbe@users.noreply.github.com> Date: Tue, 29 Mar 2022 12:31:15 -0500 Subject: [PATCH 2/2] Remove whitespace --- mongodbatlas/resource_mongodbatlas_auditing.go | 1 - 1 file changed, 1 deletion(-) diff --git a/mongodbatlas/resource_mongodbatlas_auditing.go b/mongodbatlas/resource_mongodbatlas_auditing.go index 0357e8f8ee..40296cd684 100644 --- a/mongodbatlas/resource_mongodbatlas_auditing.go +++ b/mongodbatlas/resource_mongodbatlas_auditing.go @@ -141,7 +141,6 @@ 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