restful_resource
- Supports update_body_patches
#127
Merged
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.
This PR adds support for
update_body_patches
to therestful_resource
resource. This attribute is not supposed to be used for most API providers. The only use case can be found at #125, where the API requires the resource ID for an update, which is only available after the creation.The reason this schema is designed as such, especially using the
raw_json
here is to support different data types. Note that the dynamic type can't be used here, see hashicorp/terraform-plugin-framework#973.Another attempt is to turn the patches into one single dynamic attribute named
update_body_patch
, similar to the json merge patch. While this will restrict the use of expression parameters, in that there is no trivial way to convert them into types other than string.Also, note that any change to this attribute won't cause a real update, unless the
body
has changes.Lastly, the name of
update_body_patches
is picked for the potential attributesephemeral_body_patches
(orwrite_only_body_patches
), for both create and update.Fix #125.