diff --git a/internal/checks/state_report.go b/internal/checks/state_report.go index ca02cb47aa1c..afe07740e2c5 100644 --- a/internal/checks/state_report.go +++ b/internal/checks/state_report.go @@ -5,6 +5,7 @@ package checks import ( "fmt" + "log" "github.com/hashicorp/terraform/internal/addrs" ) @@ -50,6 +51,7 @@ func (c *State) ReportCheckableObjects(configAddr addrs.ConfigCheckable, objectA checks[checkType] = make([]Status, count) } + log.Printf("[TRACE] ReportCheckableObjects: %s -> %s", configAddr, objectAddr) st.objects.Put(objectAddr, checks) } } diff --git a/internal/terraform/graph.go b/internal/terraform/graph.go index 98b1e857094a..d641fb57b4d8 100644 --- a/internal/terraform/graph.go +++ b/internal/terraform/graph.go @@ -51,6 +51,14 @@ func (g *Graph) walk(walker GraphWalker) tfdiags.Diagnostics { log.Printf("[TRACE] vertex %q: starting visit (%T)", dag.VertexName(v), v) defer func() { + if r := recover(); r != nil { + // If the walkFn panics, we get confusing logs about how the + // visit was complete. To stop this, we'll catch the panic log + // that the vertex panicked without finishing and re-panic. + log.Printf("[ERROR] vertex %q panicked", dag.VertexName(v)) + panic(r) // re-panic + } + if diags.HasErrors() { for _, diag := range diags { if diag.Severity() == tfdiags.Error { diff --git a/internal/terraform/node_module_variable.go b/internal/terraform/node_module_variable.go index 892da6a6005c..1fc34ad5f9d2 100644 --- a/internal/terraform/node_module_variable.go +++ b/internal/terraform/node_module_variable.go @@ -68,6 +68,7 @@ func (n *nodeExpandModuleVariable) DynamicExpand(ctx EvalContext) (*Graph, tfdia forEachModuleInstance(expander, n.Module, false, func(module addrs.ModuleInstance) { addr := n.Addr.Absolute(module) if checkableAddrs != nil { + log.Printf("[TRACE] nodeExpandModuleVariable: found checkable object %s", addr) checkableAddrs.Add(addr) }