core: Reinstate state-based tracking of data resource dependencies

This was inadvertently lost in the consoliation of EvalReadDataDiff and
EvalReadDataApply into a single EvalReadData.
This commit is contained in:
Martin Atkins 2018-10-02 16:56:36 -07:00
parent 206a4b5de9
commit dd8b3ab722
4 changed files with 10 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import (
type EvalReadData struct {
Addr addrs.ResourceInstance
Config *configs.Resource
Dependencies []addrs.Referenceable
Provider *providers.Interface
ProviderAddr addrs.AbsProviderConfig
ProviderSchema **ProviderSchema
@ -155,8 +156,9 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) {
}
if n.OutputState != nil {
state := &states.ResourceInstanceObject{
Value: change.After,
Status: states.ObjectPlanned, // because the partial value in the plan must be used for now
Value: change.After,
Status: states.ObjectPlanned, // because the partial value in the plan must be used for now
Dependencies: n.Dependencies,
}
*n.OutputState = state
}
@ -239,8 +241,9 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) {
},
}
state := &states.ResourceInstanceObject{
Value: change.After,
Status: states.ObjectReady, // because we completed the read from the provider
Value: change.After,
Status: states.ObjectReady, // because we completed the read from the provider
Dependencies: n.Dependencies,
}
err = ctx.Hook(func(h Hook) (HookAction, error) {

View File

@ -166,6 +166,7 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode {
&EvalReadData{
Addr: addr.Resource,
Config: n.Config,
Dependencies: n.StateReferences(),
Provider: &provider,
ProviderAddr: n.ResolvedProvider,
ProviderSchema: &providerSchema,

View File

@ -156,6 +156,7 @@ func (n *NodeApplyableResourceInstance) evalTreeDataResource(addr addrs.AbsResou
&EvalReadData{
Addr: addr.Resource,
Config: n.Config,
Dependencies: n.StateReferences(),
Planned: &change, // setting this indicates that the result must be complete
Provider: &provider,
ProviderAddr: n.ResolvedProvider,

View File

@ -98,6 +98,7 @@ func (n *NodePlannableResourceInstance) evalTreeDataResource(addr addrs.AbsResou
&EvalReadData{
Addr: addr.Resource,
Config: n.Config,
Dependencies: n.StateReferences(),
Provider: &provider,
ProviderAddr: n.ResolvedProvider,
ProviderSchema: &providerSchema,