mirror of
https://github.com/hashicorp/terraform.git
synced 2026-06-09 08:58:34 -04:00
trace: add more logging around variable validations (#35535)
This commit is contained in:
parent
4f62fcac53
commit
ef168cb25c
3 changed files with 11 additions and 0 deletions
|
|
@ -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…
Reference in a new issue