mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
fix null check and shadowed state variable
The tainted state was checked against `cty.NilVal`, however it was always being set to a null value. The refreshed state value was being shadowed, and not used in the following plan.
This commit is contained in:
parent
e4e50617aa
commit
cb7a08c691
@ -905,7 +905,7 @@ func (n *NodeAbstractResourceInstance) plan(
|
||||
// If our prior value was tainted then we actually want this to appear
|
||||
// as a replace change, even though so far we've been treating it as a
|
||||
// create.
|
||||
if action == plans.Create && priorValTainted != cty.NilVal {
|
||||
if action == plans.Create && !priorValTainted.IsNull() {
|
||||
if createBeforeDestroy {
|
||||
action = plans.CreateThenDelete
|
||||
} else {
|
||||
|
@ -128,11 +128,12 @@ func (n *NodePlannableResourceInstance) managedResourceExecute(ctx EvalContext)
|
||||
|
||||
// Refresh, maybe
|
||||
if !n.skipRefresh {
|
||||
instanceRefreshState, refreshDiags := n.refresh(ctx, instanceRefreshState)
|
||||
s, refreshDiags := n.refresh(ctx, instanceRefreshState)
|
||||
diags = diags.Append(refreshDiags)
|
||||
if diags.HasErrors() {
|
||||
return diags
|
||||
}
|
||||
instanceRefreshState = s
|
||||
|
||||
diags = diags.Append(n.writeResourceInstanceState(ctx, instanceRefreshState, n.Dependencies, refreshState))
|
||||
if diags.HasErrors() {
|
||||
|
Loading…
Reference in New Issue
Block a user