helper/resource: better error if config doesn't validate
This commit is contained in:
parent
9afebeb07e
commit
dbe5a1254a
|
@ -185,9 +185,13 @@ func testStep(
|
||||||
opts.State = state
|
opts.State = state
|
||||||
ctx := terraform.NewContext(&opts)
|
ctx := terraform.NewContext(&opts)
|
||||||
if ws, es := ctx.Validate(); len(ws) > 0 || len(es) > 0 {
|
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(
|
return state, fmt.Errorf(
|
||||||
"Configuration is invalid.\n\nWarnings: %#v\n\nErrors: %#v",
|
"Configuration is invalid.\n\nWarnings: %#v\n\nErrors: %#v",
|
||||||
ws, es)
|
ws, estrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh!
|
// Refresh!
|
||||||
|
|
Loading…
Reference in New Issue