-
Notifications
You must be signed in to change notification settings - Fork 232
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
DiffSuppressFunc doesn't work for list-type attributes #477
Comments
A variation on this: https://www.terraform.io/docs/providers/kubernetes/r/resource_quota.html Both of these resources use maps of resource quantities, mapping from a resource type (e.g. The provider suppresses diffs where possible (when explicit fields are used) but cannot apply the same logic if the keys are not known in advance: |
Another benefit of making |
In my experimentation, adding a The current behavior doesn't allow considering the who list and doing things like shuffling order, but it does allow for examining individual elements and suppressing those diffs. |
For handling Application GSLB members
This behavior is really unnatural and undocumented. I had to debug my provider to figure out what's going on under the hood. I figured a simple way to do diff suppress against the list rather than the elements:
Bug, as @toumorokoshi said, this will cause the function called on every element in the list. If you want to mitigate the problem, you can use a memory cache whose key is address of the list attribute. Looking forward to a real |
I ran into a similar situation with another provider and we are using @diabloneo's technique to hack a diff suppress on list of strings that are not maintained in order by the underlying API. |
Is there any fix planned for this? Or will this only be addressed in the new plugin framework? |
…ve the same set of values - Solution inspired by hashicorp/terraform-plugin-sdk#477 (comment) - Resolves https://linear.app/rootly/issue/SUP-37/ensure-consistent-ordering-of-association-attributes-in-api
SDK version
Relevant provider source code
terraform-plugin-sdk/helper/schema/schema.go
Line 265 in 79b4af5
Terraform Configuration Files
Expected Behavior
It should be possible to implement a
DiffSuppressFunction
that would enable ignoring the order on an attribute that is a list of strings.Actual Behavior
The
DiffSuppressFunction
schema only expects a string as the old and new attribute values; it doesn't seem possible to use on an attribute whose type is a list of strings.The text was updated successfully, but these errors were encountered: