-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
resource/aws_elb_attachment: Retry ELB attachment on InvalidTarget
error
#8483
Conversation
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.
hi @jbarrick-mesosphere thanks for handling this issue, and for your contribution. The approach looks good. I left a couple of suggestions around the practices used for timeouts and AWS error checking to help get this merged.
err := resource.Retry(600*time.Second, func() *resource.RetryError { | ||
_, err := elbconn.RegisterInstancesWithLoadBalancer(®isterInstancesOpts) | ||
|
||
if err != nil { |
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 a pattern we use throughout the code base to help when checking against AWS errors. The non-nested error checks help readability and the helper isAWSErr
wraps all the type assertion logic.
err := resource.Retry(10*time.Minute, func() *resource.RetryError {
_, err := elbconn.RegisterInstancesWithLoadBalancer(®isterInstancesOpts)
if isAWSErr(err, "InvalidTarget", "") {
return resource.RetryableError(fmt.Errorf("Error attaching instance to ELB, retrying: %s", err))
}
if err != nil {
return resource.NonRetryableError(err)
}
return nil
})
Thanks for review @nywilken ! Addressed your comments. |
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.
LGTM 👍 👍
InvalidTarget
error
InvalidTarget
errorInvalidTarget
error
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Fixes #7561
Changes proposed in this pull request:
InvalidTarget
because the instance is not running yet.