Skip to content

Commit

Permalink
Merge pull request #2815 from TimeIncOSS/f-core-ids-in-apply-errors
Browse files Browse the repository at this point in the history
core: Add resource IDs to apply-errors + prevent error duplication
  • Loading branch information
radeksimko committed Jul 27, 2015
2 parents 38ce950 + a22dc2a commit 0a6da92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion command/hook_ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion terraform/eval_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion terraform/eval_refresh.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package terraform

import (
"fmt"
"log"
)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0a6da92

Please sign in to comment.