mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-01 11:47:07 -06:00
core: Populate Dependencies of ResourceInstanceObject during apply
Previously we kept the dependencies one level higher on the resource instance itself, which meant that updating it was handled in a different EvalNode, but now we consider these to be dependencies of the object itself (derived from the configuration that was current at the time it was created), so we must handle this during EvalApply. The subtle difference here is that if an object is moved to "deposed" during a create_before_destroy replace then it will retain the dependencies it had on its last apply, rather than them being replaced by the dependencies of the newly-created object.
This commit is contained in:
parent
55222869bd
commit
f561c9c226
@ -20,6 +20,7 @@ import (
|
||||
type EvalApply struct {
|
||||
Addr addrs.ResourceInstance
|
||||
Config *configs.Resource
|
||||
Dependencies []addrs.Referenceable
|
||||
State **states.ResourceInstanceObject
|
||||
Change **plans.ResourceInstanceChange
|
||||
ProviderAddr addrs.AbsProviderConfig
|
||||
@ -171,7 +172,7 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
|
||||
Status: states.ObjectReady, // TODO: Consider marking as tainted if the provider returned errors?
|
||||
Value: newVal,
|
||||
Private: resp.Private,
|
||||
Dependencies: nil, // not populated here; this will be mutated by a later eval step
|
||||
Dependencies: n.Dependencies, // Should be populated by the caller from the StateDependencies method on the resource instance node
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,6 +332,7 @@ func (n *NodeApplyableResourceInstance) evalTreeManagedResource(addr addrs.AbsRe
|
||||
&EvalApply{
|
||||
Addr: addr.Resource,
|
||||
Config: n.Config,
|
||||
Dependencies: n.StateReferences(),
|
||||
State: &state,
|
||||
Change: &diffApply,
|
||||
Provider: &provider,
|
||||
|
Loading…
Reference in New Issue
Block a user