trace: add more logging around variable validations (#35535)

pull/35543/head
Liam Cervante 2 years ago committed by GitHub
parent 4f62fcac53
commit ef168cb25c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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)
}
}

@ -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 {

@ -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)
}

Loading…
Cancel
Save