terraform: slightly better validation error messages

This commit is contained in:
Mitchell Hashimoto 2015-02-16 19:11:23 -08:00
parent 459ad04d71
commit ae68cf1705
1 changed files with 13 additions and 3 deletions

View File

@ -1,8 +1,10 @@
package terraform package terraform
import ( import (
"fmt"
"sync" "sync"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/dag" "github.com/hashicorp/terraform/dag"
) )
@ -104,9 +106,17 @@ func (w *ContextGraphWalker) ExitEvalTree(
return err return err
} }
// Record the validation error for _, msg := range verr.Warnings {
w.ValidationWarnings = append(w.ValidationWarnings, verr.Warnings...) w.ValidationWarnings = append(
w.ValidationErrors = append(w.ValidationErrors, verr.Errors...) w.ValidationWarnings,
fmt.Sprintf("%s: %s", dag.VertexName(v), msg))
}
for _, e := range verr.Errors {
w.ValidationErrors = append(
w.ValidationErrors,
errwrap.Wrapf(fmt.Sprintf("%s: {{err}}", dag.VertexName(v)), e))
}
return nil return nil
} }