add Addr field for logging

This commit is contained in:
James Bardin 2020-09-22 17:02:10 -04:00
parent eb17d9799b
commit a0cee10720
2 changed files with 5 additions and 1 deletions

View File

@ -534,6 +534,8 @@ func (n *EvalWriteResourceState) Eval(ctx EvalContext) (interface{}, error) {
// the status of the lifecycle options stored in the state. // the status of the lifecycle options stored in the state.
// This currently only applies to create_before_destroy. // This currently only applies to create_before_destroy.
type EvalRefreshLifecycle struct { type EvalRefreshLifecycle struct {
Addr addrs.AbsResourceInstance
Config *configs.Resource Config *configs.Resource
// Prior State // Prior State
State **states.ResourceInstanceObject State **states.ResourceInstanceObject
@ -552,7 +554,8 @@ func (n *EvalRefreshLifecycle) Eval(ctx EvalContext) (interface{}, error) {
// In 0.13 we could be refreshing a resource with no config. // In 0.13 we could be refreshing a resource with no config.
// We should be operating on managed resource, but check here to be certain // We should be operating on managed resource, but check here to be certain
if n.Config == nil || n.Config.Managed == nil { if n.Config == nil || n.Config.Managed == nil {
log.Print("[WARN] no Managed config value found in instance state") log.Printf("[WARN] EvalRefreshLifecycle: no Managed config value found in instance state for %q", n.Addr)
return nil, nil
} }
state.CreateBeforeDestroy = n.Config.Managed.CreateBeforeDestroy || n.ForceCreateBeforeDestroy state.CreateBeforeDestroy = n.Config.Managed.CreateBeforeDestroy || n.ForceCreateBeforeDestroy

View File

@ -149,6 +149,7 @@ func (n *NodePlannableResourceInstance) evalTreeManagedResource(addr addrs.AbsRe
Output: &instanceRefreshState, Output: &instanceRefreshState,
}, },
&EvalRefreshLifecycle{ &EvalRefreshLifecycle{
Addr: addr,
Config: n.Config, Config: n.Config,
State: &instanceRefreshState, State: &instanceRefreshState,
ForceCreateBeforeDestroy: n.ForceCreateBeforeDestroy, ForceCreateBeforeDestroy: n.ForceCreateBeforeDestroy,