helper/resource: better error if config doesn't validate

This commit is contained in:
Mitchell Hashimoto 2014-07-10 17:01:21 -07:00
parent 9afebeb07e
commit dbe5a1254a
1 changed files with 5 additions and 1 deletions

View File

@ -185,9 +185,13 @@ func testStep(
opts.State = state
ctx := terraform.NewContext(&opts)
if ws, es := ctx.Validate(); len(ws) > 0 || len(es) > 0 {
estrs := make([]string, len(es))
for i, e := range es {
estrs[i] = e.Error()
}
return state, fmt.Errorf(
"Configuration is invalid.\n\nWarnings: %#v\n\nErrors: %#v",
ws, es)
ws, estrs)
}
// Refresh!