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.
This commit is contained in:
parent
e92559f518
commit
0d7752b0f5
|
@ -40,7 +40,14 @@ func (b *Local) opApply(
|
|||
defer func() {
|
||||
if s, ok := opState.(state.Locker); op.LockState && ok {
|
||||
if err := s.Unlock(); err != nil {
|
||||
log.Printf("[ERROR]: %s", err)
|
||||
runningOp.Err = multierror.Append(runningOp.Err,
|
||||
errwrap.Wrapf("Error unlocking state:\n\n"+
|
||||
"{{err}}\n\n"+
|
||||
"The Terraform operation completed but there was an error unlocking the state.\n"+
|
||||
"This may require unlocking the state manually with the `terraform unlock` command\n",
|
||||
err,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Reference in New Issue