From 953fe058f67f6a1db89ef5f100b92e88282dd460 Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Mon, 18 Dec 2023 12:43:58 +0100 Subject: [PATCH] fix: Doesn't disable X.509 in the project when mongodbatlas_x509_authentication_database_user resource is deleted (#1760) * don't do anything in delete * update doc * fix version * clarify doc * clarify doc --- ...resource_x509_authentication_database_user.go | 16 ++-------------- ...09_authentication_database_user.html.markdown | 2 ++ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go index d574328a23..7ba3c51820 100644 --- a/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go +++ b/internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go @@ -176,21 +176,9 @@ func resourceMongoDBAtlasX509AuthDBUserRead(ctx context.Context, d *schema.Resou } func resourceMongoDBAtlasX509AuthDBUserDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - conn := meta.(*config.MongoDBClient).Atlas - - ids := conversion.DecodeStateID(d.Id()) - currentCertificate := ids["current_certificate"] - projectID := ids["project_id"] - - if currentCertificate == "" { - _, err := conn.X509AuthDBUsers.DisableCustomerX509(ctx, projectID) - if err != nil { - return diag.FromErr(fmt.Errorf(errorCustomerX509AuthDBUsersDelete, projectID, err)) - } - } - + // We don't do anything because X.509 certificates can not be deleted or disassociated from a user. + // More info: https://jira.mongodb.org/browse/HELP-53363 d.SetId("") - return nil } diff --git a/website/docs/r/x509_authentication_database_user.html.markdown b/website/docs/r/x509_authentication_database_user.html.markdown index 4973936c1e..d3024e9724 100644 --- a/website/docs/r/x509_authentication_database_user.html.markdown +++ b/website/docs/r/x509_authentication_database_user.html.markdown @@ -17,6 +17,8 @@ description: |- -> **NOTE:** Groups and projects are synonymous terms. You may find group_id in the official documentation. +-> **NOTE:** Before provider version 1.14.0, Self-managed X.509 Authentication was disabled for the project when this resource was deleted. Starting from that version onward, it will not be disabled, allowing other users to continue using X.509 within the same project. + ## Example Usages ### Example Usage: Generate an Atlas-managed X.509 certificate for a MongoDB user