cli: Fix double check of remote workspace version

After verifying the remote backend workspace version is compatible with
the local Terraform version, we need to record that this check was
successful. Otherwise the fallback error handling path will run a strict
version check, even if the versions are compatible, which will cause an
unexpected failure.
This commit is contained in:
Alisdair McDiarmid 2021-01-13 10:43:35 -05:00
parent dcf49dc7dd
commit ddac282553
1 changed files with 5 additions and 0 deletions

View File

@ -1115,6 +1115,11 @@ func (m *Meta) remoteBackendVersionCheck(b backend.Backend, workspace string) tf
// an error
versionDiags := rb.VerifyWorkspaceTerraformVersion(workspace)
diags = diags.Append(versionDiags)
// If there are no errors resulting from this check, we do not need to
// check again
if !diags.HasErrors() {
rb.IgnoreVersionConflict()
}
}
return diags