Terraform-plugin-go DiffSuppressFunc

What is the best way to implement a DiffSuppressFunc in the new terraform-plugin-go?

I have a TypeString with json and previously just did a simple json.Compact on both to determine if a change was required.

Hi @iwarapter. If you’re comparing a JSON-encoded string for differences and just want to avoid differences that are in JSON encoding and not content, then I’d suggest using json.Unmarshal to decode the old and new values and then using reflect.DeepEqual to compare them.

We haven’t built in any helpers or utilities for this specifically (…yet?) but the way to go about doing this is in PlanResourceChange. If you decide that the value in the prior state and the value in the proposed state or config are equivalent, just set the corresponding planned state to the value already in state.