Skip to content

Commit

Permalink
r/lb_listener: Standardize retry, naming
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Apr 5, 2021
1 parent 15f2a14 commit 38bd855
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion aws/internal/service/elbv2/waiter/waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const (
LoadBalancerNetworkInterfaceDetachTimeout = 5 * time.Minute

LoadBalancerListenerCreateTimeout = 5 * time.Minute
LoadBalancedListenerReadTimeout = 2 * time.Minute
LoadBalancerListenerReadTimeout = 2 * time.Minute
LoadBalancerListenerUpdateTimeout = 5 * time.Minute
)

// LoadBalancerActive waits for a Load Balancer to return active
Expand Down
15 changes: 9 additions & 6 deletions aws/resource_aws_lb_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func resourceAwsLbListenerRead(d *schema.ResourceData, meta interface{}) error {
ListenerArns: []*string{aws.String(d.Id())},
}

err := resource.Retry(waiter.LoadBalancedListenerReadTimeout, func() *resource.RetryError {
err := resource.Retry(waiter.LoadBalancerListenerReadTimeout, func() *resource.RetryError {
var err error
output, err = conn.DescribeListeners(input)

Expand Down Expand Up @@ -919,18 +919,21 @@ func resourceAwsLbListenerUpdate(d *schema.ResourceData, meta interface{}) error
}
}

err := resource.Retry(5*time.Minute, func() *resource.RetryError {
err := resource.Retry(waiter.LoadBalancerListenerUpdateTimeout, func() *resource.RetryError {
_, err := conn.ModifyListener(params)

if tfawserr.ErrCodeEquals(err, elbv2.ErrCodeCertificateNotFoundException) {
return resource.RetryableError(err)
}

if err != nil {
if isAWSErr(err, elbv2.ErrCodeCertificateNotFoundException, "") {
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}

return nil
})

if isResourceTimeoutError(err) {
if tfresource.TimedOut(err) {
_, err = conn.ModifyListener(params)
}

Expand Down

0 comments on commit 38bd855

Please sign in to comment.