Skip to content

Commit d8c14e7

Browse files
authored
handle force-unlock error better (#47)
1 parent 094d996 commit d8c14e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

backend/backend.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ func UnLockState(metadata *types.RequestMetadata, storageClient types.StorageCli
8787
if !force {
8888
var lock types.LockInfo
8989
if err := json.Unmarshal(body, &lock); err != nil {
90-
if err == io.EOF {
90+
var syntaxError *json.SyntaxError
91+
if err == io.EOF || errors.As(err, &syntaxError) {
9192
log.Println(`WARNING: force-unlock is currently broken.
92-
Reason: https://github.com/hashicorp/terraform/blob/master/backend/remote-state/http/client.go is broken.
93+
See issue https://github.com/hashicorp/terraform/issues/28421.
9394
Unlock function in HTTP TF backend does not using lockID.
9495
Our backend would never know the ID to unlock when force-unlock was used.
9596
` + storageClient.ForceUnLockWorkaroundMessage(metadata.Params))

0 commit comments

Comments
 (0)