Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 0d7752b

Browse files
committed
Update runningOp.Err with State.Unlock error
Have the defer'ed State.Unlock call append any error to the RunningOperation.Err field. Local error would be rare and self-correcting, but when the backend.Local is using a remote state the error may require user intervention.
1 parent e92559f commit 0d7752b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

backend/local/backend_apply.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ func (b *Local) opApply(
4040
defer func() {
4141
if s, ok := opState.(state.Locker); op.LockState && ok {
4242
if err := s.Unlock(); err != nil {
43-
log.Printf("[ERROR]: %s", err)
43+
runningOp.Err = multierror.Append(runningOp.Err,
44+
errwrap.Wrapf("Error unlocking state:\n\n"+
45+
"{{err}}\n\n"+
46+
"The Terraform operation completed but there was an error unlocking the state.\n"+
47+
"This may require unlocking the state manually with the `terraform unlock` command\n",
48+
err,
49+
),
50+
)
4451
}
4552
}
4653
}()

0 commit comments

Comments
 (0)