Compare before and after paths completely

This commit is contained in:
Pam Selle 2020-10-07 14:58:43 -04:00
parent 2c352ef182
commit a927e88c06
2 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"fmt" "fmt"
"log" "log"
"reflect"
"strings" "strings"
multierror "github.com/hashicorp/go-multierror" multierror "github.com/hashicorp/go-multierror"
@ -118,7 +119,7 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
// and we should not communicate with the provider or perform further action. // and we should not communicate with the provider or perform further action.
eqV := unmarkedBefore.Equals(unmarkedAfter) eqV := unmarkedBefore.Equals(unmarkedAfter)
eq := eqV.IsKnown() && eqV.True() eq := eqV.IsKnown() && eqV.True()
if change.Action == plans.Update && eq && (len(beforePaths) != len(afterPaths)) { if change.Action == plans.Update && eq && !reflect.DeepEqual(beforePaths, afterPaths) {
return nil, diags.ErrWithWarnings() return nil, diags.ErrWithWarnings()
} }

View File

@ -3,6 +3,7 @@ package terraform
import ( import (
"fmt" "fmt"
"log" "log"
"reflect"
"strings" "strings"
"github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2"
@ -484,7 +485,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
// If we plan to write or delete sensitive paths from state, // If we plan to write or delete sensitive paths from state,
// this is an Update action // this is an Update action
if action == plans.NoOp && len(priorPaths) != len(unmarkedPaths) { if action == plans.NoOp && !reflect.DeepEqual(priorPaths, unmarkedPaths) {
action = plans.Update action = plans.Update
} }