-
Notifications
You must be signed in to change notification settings - Fork 178
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: Avoids import error for database_user when both username and auth database contain hyphens #2928
fix: Avoids import error for database_user when both username and auth database contain hyphens #2928
Changes from 5 commits
438af88
fd1e11e
ab0f229
a56ed8f
c866b36
caef9ba
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
resource/mongodbatlas_database_user: Avoids import error for database_user when both username and auth database contain hyphens | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,14 @@ import ( | |
"github.com/hashicorp/terraform-plugin-framework/resource" | ||
) | ||
|
||
func ImportSplit3(importRaw string) (ok bool, part1, part2, part3 string) { | ||
parts := strings.Split(importRaw, "/") | ||
if len(parts) != 3 { | ||
return false, "", "", "" | ||
} | ||
return true, parts[0], parts[1], parts[2] | ||
} | ||
|
||
Comment on lines
+13
to
+20
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. [Curious] Is the use of 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. +1 would update the resource documentation import section. 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. 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. nice. Left a small comment on the import doc but this is good for me. 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 decision does indeed bring a good conversation to have if it should be extended to all resources |
||
func ImportStateProjectIDClusterName(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse, attrNameProjectID, attrNameClusterName string) { | ||
parts := strings.SplitN(req.ID, "-", 2) | ||
if len(parts) != 2 { | ||
|
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.
Should we include here when user needs to use one format vs. the other?
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.
Good point to explain why and when
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.
Updated in caef9ba