mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-01 11:47:07 -06:00
core: EvalApply should pass configuration value to provider
This allows the provider to distinguish whether a particular value is set in configuration or whether it's coming from prior state. It has no particular purpose other than that.
This commit is contained in:
parent
b83a563cf0
commit
27745af0ea
@ -53,15 +53,24 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
|
||||
*n.CreateNew = (change.Action == plans.Create || change.Action == plans.Replace)
|
||||
}
|
||||
|
||||
configVal := cty.NullVal(cty.DynamicPseudoType) // TODO: Populate this when n.Config is non-nil; will need config and provider schema in here
|
||||
configVal := cty.NullVal(cty.DynamicPseudoType)
|
||||
if n.Config != nil {
|
||||
var configDiags tfdiags.Diagnostics
|
||||
keyData := EvalDataForInstanceKey(n.Addr.Key)
|
||||
configVal, _, configDiags = ctx.EvaluateBlock(n.Config.Config, schema, nil, keyData)
|
||||
diags = diags.Append(configDiags)
|
||||
if configDiags.HasErrors() {
|
||||
return nil, diags.Err()
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] %s: applying the planned %s change", n.Addr.Absolute(ctx.Path()), change.Action)
|
||||
resp := provider.ApplyResourceChange(providers.ApplyResourceChangeRequest{
|
||||
TypeName: n.Addr.Resource.Type,
|
||||
PriorState: change.Before,
|
||||
Config: configVal, // TODO
|
||||
Config: configVal,
|
||||
PlannedState: change.After,
|
||||
PlannedPrivate: change.Private, // TODO
|
||||
PlannedPrivate: change.Private,
|
||||
})
|
||||
applyDiags := resp.Diagnostics
|
||||
if n.Config != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user