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
Changes from 1 commit
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,8 @@ 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a breaking change? Do we want to hold it on after we release 1.14.0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess it's not a breaking change because it'd return error now...

Copy link
Member Author

@lantoli lantoli Dec 15, 2023

Choose a reason for hiding this comment

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

no, on the contrary, the client wants this as soon as possible. The behavior will change, but for the better, because current behavior is unexpected

Copy link
Member

@AgustinBettati AgustinBettati Dec 15, 2023

Choose a reason for hiding this comment

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

I understand we are limited in what we can for this scenario, but just want to make sure there are no significant side effects.
From what I understand if a user now deletes the mongodbatlas_x509_authentication_database_user the "Self-Managed X.509 Authentication" setting would still be enabled, and the users would have to disable manually if that is his intention.

Copy link
Member Author

@lantoli lantoli Dec 15, 2023

Choose a reason for hiding this comment

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

correct. but the normal use case is to have multiple users, so when you disable one you don't want to disable others.
As an example in Atlas UI when you delete the database user, X.509 project config keeps enabled. Here we're doing the same behavior as in the UI.

Copy link
Member Author

Choose a reason for hiding this comment

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

there is useful info in the comments in: https://jira.mongodb.org/browse/HELP-53363

Copy link
Member Author

Choose a reason for hiding this comment

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

doc updated

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe worth it to mention https://jira.mongodb.org/browse/HELP-53363 in the comment

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, done

d.SetId("")

return nil
}

Expand Down