Merge pull request #28820 from hashicorp/radditude/refresh-error-message

backend/remote: point refresh users towards -refresh-only
This commit is contained in:
CJ Horton 2021-05-27 07:21:37 -07:00 committed by GitHub
commit 2f980f1dfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -721,6 +721,10 @@ func (b *Remote) Operation(ctx context.Context, op *backend.Operation) (*backend
f = b.opPlan f = b.opPlan
case backend.OperationTypeApply: case backend.OperationTypeApply:
f = b.opApply f = b.opApply
case backend.OperationTypeRefresh:
return nil, fmt.Errorf(
"\n\nThe \"refresh\" operation is not supported when using the \"remote\" backend. " +
"Use \"terraform apply -refresh-only\" instead.")
default: default:
return nil, fmt.Errorf( return nil, fmt.Errorf(
"\n\nThe \"remote\" backend does not support the %q operation.", op.Type) "\n\nThe \"remote\" backend does not support the %q operation.", op.Type)