diff --git a/command/hook_ui.go b/command/hook_ui.go index c9543b3f6..6a10ceefb 100644 --- a/command/hook_ui.go +++ b/command/hook_ui.go @@ -140,7 +140,8 @@ func (h *UiHook) PostApply( } if applyerr != nil { - msg = fmt.Sprintf("Error: %s", applyerr) + // Errors are collected and printed in ApplyCommand, no need to duplicate + return terraform.HookActionContinue, nil } h.ui.Output(h.Colorize.Color(fmt.Sprintf( diff --git a/terraform/eval_apply.go b/terraform/eval_apply.go index cebf68265..c22a6ca4e 100644 --- a/terraform/eval_apply.go +++ b/terraform/eval_apply.go @@ -94,7 +94,8 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) { // if we have one, otherwise we just output it. if err != nil { if n.Error != nil { - *n.Error = multierror.Append(*n.Error, err) + helpfulErr := fmt.Errorf("%s: %s", n.Info.Id, err.Error()) + *n.Error = multierror.Append(*n.Error, helpfulErr) } else { return nil, err } diff --git a/terraform/eval_refresh.go b/terraform/eval_refresh.go index 3d25ecc8b..fa2b8126c 100644 --- a/terraform/eval_refresh.go +++ b/terraform/eval_refresh.go @@ -1,6 +1,7 @@ package terraform import ( + "fmt" "log" ) @@ -35,7 +36,7 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) { // Refresh! state, err = provider.Refresh(n.Info, state) if err != nil { - return nil, err + return nil, fmt.Errorf("%s: %s", n.Info.Id, err.Error()) } // Call post-refresh hook