Skip to content

Conversation

@prashantv
Copy link
Collaborator

@prashantv prashantv commented Aug 26, 2022

hashicorp/terraform-plugin-sdk#895

When calculating a diff, sets are added as delete of all old attributes
and a create of all new attributes. When DiffSuppressFunc is used, the
delete attribute drops the NewRemoved field, which results in sending
a diff that ends up creating a new empty set element.

Without the fix, the test fails:

=== RUN   TestSchemaMap_Diff/30-Set_with_DiffSuppressFunc
    schema_test.go:3188: expected:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:true, [...]

        got:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, [...] NewRemoved:false, [...]

Previously, NewRemoved was set to false for the sustain field even though it belonged to an element being removed.

hashicorp/terraform-plugin-sdk#895

When calculating a diff, sets are added as delete of all old attributes
and a create of all new attributes. When DiffSuppressFunc is used, the
delete attribute drops the `NewRemoved` field, which results in sending
a diff that ends up creating a new empty set element.
@prashantv prashantv requested a review from codygibb August 26, 2022 18:59
@prashantv prashantv merged commit c747872 into main Aug 26, 2022
@prashantv prashantv deleted the set-fix branch August 26, 2022 19:07
@prashantv
Copy link
Collaborator Author

Upstream PR: hashicorp/terraform-plugin-sdk#1042

aschepis pushed a commit that referenced this pull request Dec 16, 2024
hashicorp/terraform-plugin-sdk#895

When calculating a diff, sets are added as delete of all old attributes
and a create of all new attributes. When DiffSuppressFunc is used, the
delete attribute drops the `NewRemoved` field, which results in sending
a diff that ends up creating a new empty set element.

Without the fix, the test fails:
```
=== RUN   TestSchemaMap_Diff/30-Set_with_DiffSuppressFunc
    schema_test.go:3188: expected:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:true, [...]

        got:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, [...] NewRemoved:false, [...]
```

Previously, `NewRemoved` was set to false for the sustain field even though it belonged to an element being removed.
aschepis pushed a commit that referenced this pull request Dec 16, 2024
hashicorp/terraform-plugin-sdk#895

When calculating a diff, sets are added as delete of all old attributes
and a create of all new attributes. When DiffSuppressFunc is used, the
delete attribute drops the `NewRemoved` field, which results in sending
a diff that ends up creating a new empty set element.

Without the fix, the test fails:
```
=== RUN   TestSchemaMap_Diff/30-Set_with_DiffSuppressFunc
    schema_test.go:3188: expected:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:true, [...]

        got:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, [...] NewRemoved:false, [...]
```

Previously, `NewRemoved` was set to false for the sustain field even though it belonged to an element being removed.
marcushill pushed a commit that referenced this pull request Jul 30, 2025
hashicorp/terraform-plugin-sdk#895

When calculating a diff, sets are added as delete of all old attributes
and a create of all new attributes. When DiffSuppressFunc is used, the
delete attribute drops the `NewRemoved` field, which results in sending
a diff that ends up creating a new empty set element.

Without the fix, the test fails:
```
=== RUN   TestSchemaMap_Diff/30-Set_with_DiffSuppressFunc
    schema_test.go:3188: expected:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, NewRemoved:true, [...]

        got:
        *terraform.InstanceDiff{ [...]"rule.80.duration":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:false, [...] NewRemoved:false, [...]
```

Previously, `NewRemoved` was set to false for the sustain field even though it belonged to an element being removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants