core: More TRACE logging for the "terraform import" walk

This commit is contained in:
Martin Atkins 2018-05-29 13:13:45 -07:00
parent 7f3d7313d8
commit 9c0335e22e
2 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package terraform
import ( import (
"fmt" "fmt"
"log"
"github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/tfdiags" "github.com/hashicorp/terraform/tfdiags"
@ -38,6 +39,14 @@ func (n *EvalImportState) Eval(ctx EvalContext) (interface{}, error) {
"import %s (id: %s): %s", n.Info.HumanId(), n.Id, err) "import %s (id: %s): %s", n.Info.HumanId(), n.Id, err)
} }
for _, s := range state {
if s == nil {
log.Printf("[TRACE] EvalImportState: import %s %q produced a nil state", n.Info.HumanId(), n.Id)
continue
}
log.Printf("[TRACE] EvalImportState: import %s %q produced state for %s with id %q", n.Info.HumanId(), n.Id, s.Ephemeral.Type, s.ID)
}
if n.Output != nil { if n.Output != nil {
*n.Output = state *n.Output = state
} }

View File

@ -43,6 +43,9 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("%s: %s", n.Addr.Absolute(ctx.Path()), err.Error()) return nil, fmt.Errorf("%s: %s", n.Addr.Absolute(ctx.Path()), err.Error())
} }
if state == nil {
log.Printf("[TRACE] EvalRefresh: after refresh, %s has nil state", n.Addr)
}
// Call post-refresh hook // Call post-refresh hook
err = ctx.Hook(func(h Hook) (HookAction, error) { err = ctx.Hook(func(h Hook) (HookAction, error) {