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