Merge pull request #25341 from hashicorp/jbardin/remote-panic

prevent panic in remote backend retry
This commit is contained in:
James Bardin 2020-06-22 15:12:50 -04:00 committed by GitHub
commit 41befeaa37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -495,7 +495,7 @@ func (b *Remote) retryLogHook(attemptNum int, resp *http.Response) {
// The retry logic in the TFE client will retry both rate limited
// requests and server errors, but in the remote backend we only
// care about server errors so we ignore rate limit (429) errors.
if attemptNum == 0 || resp.StatusCode == 429 {
if attemptNum == 0 || (resp != nil && resp.StatusCode == 429) {
// Reset the last retry time.
b.lastRetry = time.Now()
return