terraform: shadow graph uses GraphWalkerPanicwrap to catch errors

This commit is contained in:
Mitchell Hashimoto 2016-11-03 12:09:51 -07:00
parent da508d6a8b
commit 90bfff3026
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 6 additions and 3 deletions

View File

@ -736,11 +736,14 @@ func (c *Context) walk(
// If we have a shadow graph, wait for that to complete.
if shadowCloser != nil {
// Build the graph walker for the shadow.
shadowWalker := &ContextGraphWalker{
// Build the graph walker for the shadow. We also wrap this in
// a panicwrap so that panics are captured. For the shadow graph,
// we just want panics to be normal errors rather than to crash
// Terraform.
shadowWalker := GraphWalkerPanicwrap(&ContextGraphWalker{
Context: shadowCtx,
Operation: operation,
}
})
// Kick off the shadow walk. This will block on any operations
// on the real walk so it is fine to start first.