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

restful_resource - Supports update_body_patches #127

Merged
merged 4 commits into from
Nov 13, 2024
Merged

Conversation

magodo
Copy link
Owner

@magodo magodo commented Nov 13, 2024

This PR adds support for update_body_patches to the restful_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 attributes ephemeral_body_patches (or write_only_body_patches), for both create and update.

Fix #125.

@magodo magodo added the enhancement New feature or request label Nov 13, 2024
@magodo magodo merged commit 35e32f9 into main Nov 13, 2024
@mdepedrof
Copy link

Its perfect! thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add update_data option
2 participants