@@ -795,7 +795,7 @@ func (n *NodeAbstractResourceInstance) plan(
795795 plannedChange * plans.ResourceInstanceChange ,
796796 currentState * states.ResourceInstanceObject ,
797797 createBeforeDestroy bool ,
798- forceReplace []addrs. AbsResourceInstance ,
798+ forceReplace bool ,
799799) (* plans.ResourceInstanceChange , * states.ResourceInstanceObject , * providers.Deferred , instances.RepetitionData , tfdiags.Diagnostics ) {
800800 var diags tfdiags.Diagnostics
801801 var keyData instances.RepetitionData
@@ -2975,34 +2975,15 @@ func resourceInstancePrevRunAddr(ctx EvalContext, currentAddr addrs.AbsResourceI
29752975 return table .OldAddr (currentAddr )
29762976}
29772977
2978- func getAction (addr addrs.AbsResourceInstance , priorVal , plannedNewVal cty.Value , createBeforeDestroy bool , writeOnly cty.PathSet , forceReplace []addrs.AbsResourceInstance , reqRep cty.PathSet ) (action plans.Action , actionReason plans.ResourceInstanceChangeActionReason ) {
2979- // The user might also ask us to force replacing a particular resource
2980- // instance, regardless of whether the provider thinks it needs replacing.
2981- // For example, users typically do this if they learn a particular object
2982- // has become degraded in an immutable infrastructure scenario and so
2983- // replacing it with a new object is a viable repair path.
2984- matchedForceReplace := false
2985- for _ , candidateAddr := range forceReplace {
2986- if candidateAddr .Equal (addr ) {
2987- matchedForceReplace = true
2988- break
2989- }
2990-
2991- // For "force replace" purposes we require an exact resource instance
2992- // address to match. If a user forgets to include the instance key
2993- // for a multi-instance resource then it won't match here, but we
2994- // have an earlier check in NodePlannableResource.Execute that should
2995- // prevent us from getting here in that case.
2996- }
2997-
2978+ func getAction (addr addrs.AbsResourceInstance , priorVal , plannedNewVal cty.Value , createBeforeDestroy bool , writeOnly cty.PathSet , forceReplace bool , reqRep cty.PathSet ) (action plans.Action , actionReason plans.ResourceInstanceChangeActionReason ) {
29982979 // Unmark for this test for value equality.
29992980 eqV := plannedNewVal .Equals (priorVal )
30002981 eq := eqV .IsKnown () && eqV .True ()
30012982
30022983 switch {
30032984 case priorVal .IsNull ():
30042985 action = plans .Create
3005- case matchedForceReplace || ! reqRep .Empty () || ! writeOnly .Intersection (reqRep ).Empty ():
2986+ case forceReplace || ! reqRep .Empty () || ! writeOnly .Intersection (reqRep ).Empty ():
30062987 // If the user "forced replace" of this instance of if there are any
30072988 // "requires replace" paths left _after our filtering above_ then this
30082989 // is a replace action.
@@ -3012,12 +2993,12 @@ func getAction(addr addrs.AbsResourceInstance, priorVal, plannedNewVal cty.Value
30122993 action = plans .DeleteThenCreate
30132994 }
30142995 switch {
3015- case matchedForceReplace :
2996+ case forceReplace :
30162997 actionReason = plans .ResourceInstanceReplaceByRequest
30172998 case ! reqRep .Empty ():
30182999 actionReason = plans .ResourceInstanceReplaceBecauseCannotUpdate
30193000 }
3020- case eq && ! matchedForceReplace :
3001+ case eq && ! forceReplace :
30213002 action = plans .NoOp
30223003 default :
30233004 action = plans .Update
0 commit comments