-
Notifications
You must be signed in to change notification settings - Fork 189
INTMDB-448: custom_db_role error #1009
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
Changes from all 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 |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"net/http" | ||
"regexp" | ||
"strings" | ||
"sync" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
|
@@ -101,7 +102,13 @@ func resourceMongoDBAtlasCustomDBRole() *schema.Resource { | |
} | ||
} | ||
|
||
var ( | ||
customRoleLock sync.Mutex | ||
) | ||
|
||
func resourceMongoDBAtlasCustomDBRoleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
customRoleLock.Lock() | ||
defer customRoleLock.Unlock() | ||
Comment on lines
+110
to
+111
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. [q] Could you give me more details about why we hit this issue? Thanks 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. Atlas API if you run each terraform resource apply sequentially in slow motion i.e. debugger it updates state correctly 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. @andreaangiolillo brief example here: https://drive.google.com/file/d/1aDfPwxjXm35qkEQgP135M6FxZAss5Qlv/view |
||
conn := meta.(*MongoDBClient).Atlas | ||
projectID := d.Get("project_id").(string) | ||
|
||
|
@@ -180,6 +187,8 @@ func resourceMongoDBAtlasCustomDBRoleRead(ctx context.Context, d *schema.Resourc | |
} | ||
|
||
func resourceMongoDBAtlasCustomDBRoleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
customRoleLock.Lock() | ||
defer customRoleLock.Unlock() | ||
conn := meta.(*MongoDBClient).Atlas | ||
ids := decodeStateID(d.Id()) | ||
projectID := ids["project_id"] | ||
|
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.
[q] Why did we pass "1" here?
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.
When I fixed concurrency issue other acceptance tests in parallel would increase count > 1 and fail test