-
Notifications
You must be signed in to change notification settings - Fork 167
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
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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