Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress partition resource changed for TF for total_bytes prop #508

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sumologic/resource_sumologic_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func resourceSumologicPartition() *schema.Resource {
"total_bytes": {
Type: schema.TypeInt,
Computed: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return true
},
Comment on lines +53 to +55
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dagould @sumovishal What we are trying to achieve here is to not show that resource has changed during terraform plan if attribute total_bytes has changed.
I could see that always returning true using DiffSuppressFunc can be used to suppress this but not sure if there's better alternative that can be done.
Is there a way to smh ignore this during the serialization of the resource itself?

I can see some other alternatives like ignore_changes, customizeDiff but these doesn’t look like any different than to directly have inside resource schema.

Copy link
Collaborator

@sumovishal sumovishal Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DiffSuppressFunc is the right way to do it. ignore_changes applies to a resource block, not the provider.

},
"data_forwarding_id": {
Type: schema.TypeString,
Expand Down