-
Notifications
You must be signed in to change notification settings - Fork 165
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thx, done |
||
d.SetId("") | ||
|
||
return nil | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels incomplete. Should we clarify that now we do nothing and why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thx, added more info |
||
|
||
## Example Usages | ||
|
||
### Example Usage: Generate an Atlas-managed X.509 certificate for a MongoDB user | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc updated