[bug] suppress gzip diff unless fields are explicitly set #441
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We recently made some changes to our Gzip API endpoint.
Previously, the endpoint accepted an empty value for
content_types
andextensions
parameters (ie.,""
is stored in DB as the value). But after the change, API will set their default values if an empty value is sent for these parameters from clients.This results in unexpected (and potentially infinite) diff as the TF state file contains no data for these parameters but the API returns different data upon refresh.
Since Terraform Plugin SDK currently does not support a way to configure a
Default
forTypeList/TypeSet
, the only workaround seems to be ignoring these fields in the API response IF those values are not set explicitly in the TF file by the user. Or, we can also make these fieldsRequired
(+ disallow empty value) even though they're optional in the API spec.This PR also introduces a downside where remote changes for those particular fields will be ignored unless users set them in TF file.
For example, with this gzip block setting:
and if I change
content_types
orextensions
value on the UI, the subsequent TF runs won't report any diff. But I think that's acceptable.