core: EvalReadDataDiff to output direct config value alongside planned
We're now writing the "planned new value" to OutputValue, but the data resource nodes during refresh need to see the verbatim config value in order to decide whether read must be deferred to the apply phase, so we'll optionally export that here too.
This commit is contained in:
parent
20adb9d9b7
commit
182e783885
|
@ -24,6 +24,7 @@ type EvalReadDataDiff struct {
|
||||||
|
|
||||||
Output **plans.ResourceInstanceChange
|
Output **plans.ResourceInstanceChange
|
||||||
OutputValue *cty.Value
|
OutputValue *cty.Value
|
||||||
|
OutputConfigValue *cty.Value
|
||||||
OutputState **states.ResourceInstanceObject
|
OutputState **states.ResourceInstanceObject
|
||||||
|
|
||||||
// Set Previous when re-evaluating diff during apply, to ensure that
|
// Set Previous when re-evaluating diff during apply, to ensure that
|
||||||
|
@ -114,10 +115,12 @@ func (n *EvalReadDataDiff) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
if n.Output != nil {
|
if n.Output != nil {
|
||||||
*n.Output = change
|
*n.Output = change
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.OutputValue != nil {
|
if n.OutputValue != nil {
|
||||||
*n.OutputValue = change.After
|
*n.OutputValue = change.After
|
||||||
}
|
}
|
||||||
|
if n.OutputConfigValue != nil {
|
||||||
|
*n.OutputConfigValue = configVal
|
||||||
|
}
|
||||||
|
|
||||||
if n.OutputState != nil {
|
if n.OutputState != nil {
|
||||||
state := &states.ResourceInstanceObject{
|
state := &states.ResourceInstanceObject{
|
||||||
|
|
|
@ -150,7 +150,7 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode {
|
||||||
ProviderAddr: n.ResolvedProvider,
|
ProviderAddr: n.ResolvedProvider,
|
||||||
ProviderSchema: &providerSchema,
|
ProviderSchema: &providerSchema,
|
||||||
Output: &change,
|
Output: &change,
|
||||||
OutputValue: &configVal,
|
OutputConfigValue: &configVal,
|
||||||
OutputState: &state,
|
OutputState: &state,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue