-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I want the backend to start use 423 Locked in some situations (currently 503 Service Unavailable is used).
Seeing the provider does handle 503 responses with retries, I would like if the provider did handle 423 responses with retries too, to not disrupt scenarios where the situation leading to a 423 response was transient.
terraform-provider-cloudamqp/api/api.go
Lines 57 to 89 in bd0a39f
| case request.customRetryCode: | |
| if _, ok := ctx.Deadline(); !ok { | |
| return fmt.Errorf("context has no deadline") | |
| } | |
| tflog.Debug(ctx, fmt.Sprintf("custom retry logic, will try again, attempt=%d", request.attempt)) | |
| // Intentionally fall through to retry logic below | |
| case 200, 201, 202, 204: | |
| return nil | |
| case 400, 409: | |
| if errStr, ok := (*request.failed)["error"].(string); ok && errStr == "Timeout talking to backend" { | |
| if _, ok := ctx.Deadline(); !ok { | |
| return fmt.Errorf("context has no deadline") | |
| } | |
| tflog.Debug(ctx, fmt.Sprintf("timeout talking to backend, will try again, attempt=%d", request.attempt)) | |
| } else if msg, ok := (*request.failed)["message"].(string); ok { | |
| return fmt.Errorf("getting %s: %s", request.resourceName, msg) | |
| } else { | |
| return fmt.Errorf("getting %s: %v", request.resourceName, *request.failed) | |
| } | |
| case 404: | |
| tflog.Warn(ctx, fmt.Sprintf("the %s was not found", request.resourceName)) | |
| return nil | |
| case 410: | |
| tflog.Warn(ctx, fmt.Sprintf("the %s has been deleted", request.resourceName)) | |
| return nil | |
| case 503: | |
| if _, ok := ctx.Deadline(); !ok { | |
| return fmt.Errorf("context has no deadline") | |
| } | |
| tflog.Debug(ctx, fmt.Sprintf("service unavailable, will try again, attempt=%d", request.attempt)) | |
| default: | |
| return fmt.Errorf("unexpected status code: %d", response.StatusCode) | |
| } |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request