backend/remote: Fix broken state lock retry

When using the -lock-timeout option with the remote backend configured
in local operations mode, Terraform would fail to retry acquiring the
lock. This was caused by the lock error message having a missing Info
field, which the state manager requires to be present in order to
attempt retries.
This commit is contained in:
Alisdair McDiarmid 2021-02-19 15:47:18 -05:00
parent 6871d0c991
commit 02eb283ad4
1 changed files with 1 additions and 0 deletions

View File

@ -117,6 +117,7 @@ func (r *remoteClient) Lock(info *statemgr.LockInfo) (string, error) {
}) })
if err != nil { if err != nil {
if err == tfe.ErrWorkspaceLocked { if err == tfe.ErrWorkspaceLocked {
lockErr.Info = info
err = fmt.Errorf("%s (lock ID: \"%s/%s\")", err, r.organization, r.workspace.Name) err = fmt.Errorf("%s (lock ID: \"%s/%s\")", err, r.organization, r.workspace.Name)
} }
lockErr.Err = err lockErr.Err = err