Skip to content

Commit 953fe05

Browse files
authored
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
1 parent 77d4140 commit 953fe05

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

internal/service/x509authenticationdatabaseuser/resource_x509_authentication_database_user.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,9 @@ func resourceMongoDBAtlasX509AuthDBUserRead(ctx context.Context, d *schema.Resou
176176
}
177177

178178
func resourceMongoDBAtlasX509AuthDBUserDelete(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
179-
conn := meta.(*config.MongoDBClient).Atlas
180-
181-
ids := conversion.DecodeStateID(d.Id())
182-
currentCertificate := ids["current_certificate"]
183-
projectID := ids["project_id"]
184-
185-
if currentCertificate == "" {
186-
_, err := conn.X509AuthDBUsers.DisableCustomerX509(ctx, projectID)
187-
if err != nil {
188-
return diag.FromErr(fmt.Errorf(errorCustomerX509AuthDBUsersDelete, projectID, err))
189-
}
190-
}
191-
179+
// We don't do anything because X.509 certificates can not be deleted or disassociated from a user.
180+
// More info: https://jira.mongodb.org/browse/HELP-53363
192181
d.SetId("")
193-
194182
return nil
195183
}
196184

website/docs/r/x509_authentication_database_user.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ description: |-
1717

1818
-> **NOTE:** Groups and projects are synonymous terms. You may find group_id in the official documentation.
1919

20+
-> **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.
21+
2022
## Example Usages
2123

2224
### Example Usage: Generate an Atlas-managed X.509 certificate for a MongoDB user

0 commit comments

Comments
 (0)