Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Doesn't disable X.509 in the project when mongodbatlas_x509_authentication_database_user resource is deleted #1760

Merged
merged 5 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. From that version on, it is not disabled because the other users may want to continue using X.509.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-> **NOTE:** Before provider version 1.14.0, Self-managed X.509 Authentication was disabled for the project when this resource was deleted. From that version on, it is not disabled because the other users may want to continue using X.509.
-> **NOTE:** Before provider version 1.14.0, Self-managed X.509 Authentication was disabled for the project when this resource was deleted. From that version on, it won't be disabled to let other users continue using X.509 within the same project.

@lantoli check if within the same project is correct please. If you are ok, accept the suggestion (just a minor word refactoring).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, changing for a similar sentence

## Example Usages

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