-
Notifications
You must be signed in to change notification settings - Fork 55
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
Check for Resource Already Exist Error before retry #243
Conversation
if err != nil { | ||
return diag.Errorf("[ERR] failed to create instance after multiple attempts: %s", err) | ||
if errors.Is(err, civogo.DatabaseInstanceDuplicateNameError) { |
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 the only error we want to verify? There are multiple errors are present, What will happen to those?
if err != nil { | ||
|
||
// Check for the resource already exists error | ||
if errors.Is(err, civogo.DatabaseNetworkExistsError) { |
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.
Same comment as above
@vishalanarase there are a ton of errors in the SDK not feasible to check for all of them. Duplicate name is the most common one hence checking for that only to improve the experience. for other errors tf will error out after all the retry. But for Duplicate Resource it will error out immediately without retry. |
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.
This is good, but there may be other resources aside from network and instances, may be worth checking kubernetes, and others as well.
Fixes: #234