@@ -777,7 +777,7 @@ func (n *NodeAbstractResourceInstance) plan(
777777 // starting values.
778778 // Here we operate on the marked values, so as to revert any changes to the
779779 // marks as well as the value.
780- configValIgnored , ignoreChangeDiags := n .processIgnoreChanges (priorVal , origConfigVal )
780+ configValIgnored , ignoreChangeDiags := n .processIgnoreChanges (priorVal , origConfigVal , schema )
781781 diags = diags .Append (ignoreChangeDiags )
782782 if ignoreChangeDiags .HasErrors () {
783783 return plan , state , keyData , diags
@@ -881,7 +881,7 @@ func (n *NodeAbstractResourceInstance) plan(
881881 // providers that we must accommodate the behavior for now, so for
882882 // ignore_changes to work at all on these values, we will revert the
883883 // ignored values once more.
884- plannedNewVal , ignoreChangeDiags = n .processIgnoreChanges (unmarkedPriorVal , plannedNewVal )
884+ plannedNewVal , ignoreChangeDiags = n .processIgnoreChanges (unmarkedPriorVal , plannedNewVal , schema )
885885 diags = diags .Append (ignoreChangeDiags )
886886 if ignoreChangeDiags .HasErrors () {
887887 return plan , state , keyData , diags
@@ -1145,7 +1145,7 @@ func (n *NodeAbstractResourceInstance) plan(
11451145 return plan , state , keyData , diags
11461146}
11471147
1148- func (n * NodeAbstractResource ) processIgnoreChanges (prior , config cty.Value ) (cty.Value , tfdiags.Diagnostics ) {
1148+ func (n * NodeAbstractResource ) processIgnoreChanges (prior , config cty.Value , schema * configschema. Block ) (cty.Value , tfdiags.Diagnostics ) {
11491149 // ignore_changes only applies when an object already exists, since we
11501150 // can't ignore changes to a thing we've not created yet.
11511151 if prior .IsNull () {
@@ -1158,9 +1158,23 @@ func (n *NodeAbstractResource) processIgnoreChanges(prior, config cty.Value) (ct
11581158 if len (ignoreChanges ) == 0 && ! ignoreAll {
11591159 return config , nil
11601160 }
1161+
11611162 if ignoreAll {
1162- return prior , nil
1163+ // If we are trying to ignore all attribute changes, we must filter
1164+ // computed attributes out from the prior state to avoid sending them
1165+ // to the provider as if they were included in the configuration.
1166+ ret , _ := cty .Transform (prior , func (path cty.Path , v cty.Value ) (cty.Value , error ) {
1167+ attr := schema .AttributeByPath (path )
1168+ if attr != nil && attr .Computed && ! attr .Optional {
1169+ return cty .NullVal (v .Type ()), nil
1170+ }
1171+
1172+ return v , nil
1173+ })
1174+
1175+ return ret , nil
11631176 }
1177+
11641178 if prior .IsNull () || config .IsNull () {
11651179 // Ignore changes doesn't apply when we're creating for the first time.
11661180 // Proposed should never be null here, but if it is then we'll just let it be.
0 commit comments