@@ -14,8 +14,10 @@ import (
1414
1515 "github.com/zclconf/go-cty/cty"
1616
17+ "github.com/hashicorp/go-hclog"
1718 "github.com/hashicorp/terraform/internal/addrs"
1819 "github.com/hashicorp/terraform/internal/command/format"
20+ "github.com/hashicorp/terraform/internal/logging"
1921 "github.com/hashicorp/terraform/internal/plans"
2022 "github.com/hashicorp/terraform/internal/providers"
2123 "github.com/hashicorp/terraform/internal/terraform"
@@ -31,6 +33,7 @@ func NewUiHook(view *View) *UiHook {
3133 view : view ,
3234 periodicUiTimer : defaultPeriodicUiTimer ,
3335 resources : make (map [string ]uiResourceState ),
36+ log : logging .HCLogger (),
3437 }
3538}
3639
@@ -44,6 +47,8 @@ type UiHook struct {
4447
4548 resources map [string ]uiResourceState
4649 resourcesLock sync.Mutex
50+
51+ log hclog.Logger
4752}
4853
4954var _ terraform.Hook = (* UiHook )(nil )
@@ -345,6 +350,7 @@ func (h *UiHook) PreApplyImport(id terraform.HookResourceIdentity, importing pla
345350 if importing .Identity != nil {
346351 ty , err := importing .Identity .ImpliedType ()
347352 if err != nil {
353+ h .log .Debug ("UiHook: PreApplyImport failed to get identity ImpliedType" , err )
348354 h .println (fmt .Sprintf (
349355 h .view .colorize .Color ("[reset][bold]%s: Importing... [identity=(type error)]" ),
350356 id .Addr ,
@@ -353,6 +359,7 @@ func (h *UiHook) PreApplyImport(id terraform.HookResourceIdentity, importing pla
353359 }
354360 val , err := importing .Identity .Decode (ty )
355361 if err != nil {
362+ h .log .Debug ("UiHook: PreApplyImport failed to decode identity" , err )
356363 h .println (fmt .Sprintf (
357364 h .view .colorize .Color ("[reset][bold]%s: Importing... [identity=(decode error)]" ),
358365 id .Addr ,
@@ -378,6 +385,7 @@ func (h *UiHook) PostApplyImport(id terraform.HookResourceIdentity, importing pl
378385 if importing .Identity != nil {
379386 ty , err := importing .Identity .ImpliedType ()
380387 if err != nil {
388+ h .log .Debug ("UiHook: PostApplyImport failed to get identity ImpliedType" , err )
381389 h .println (fmt .Sprintf (
382390 h .view .colorize .Color ("[reset][bold]%s: Import complete [identity=(type error)]" ),
383391 id .Addr ,
@@ -386,6 +394,7 @@ func (h *UiHook) PostApplyImport(id terraform.HookResourceIdentity, importing pl
386394 }
387395 val , err := importing .Identity .Decode (ty )
388396 if err != nil {
397+ h .log .Debug ("UiHook: PostApplyImport failed to decode identity" , err )
389398 h .println (fmt .Sprintf (
390399 h .view .colorize .Color ("[reset][bold]%s: Import complete [identity=(decode error)]" ),
391400 id .Addr ,
0 commit comments