-
Notifications
You must be signed in to change notification settings - Fork 4
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
resources - Change body
, delete_body
, output
from string tpye to dynamic type
#87
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit changes the type of `body` from string to dynamic type. Accordingly, it removes the `write_only_attrs` as it now can be replaced by the `lifecycle.ignore_changes`. Whilst some of the attributes are still required: - `force_new_attrs`: This can't be replaced by `lifecycle.replace_triggered_by`, as the latter can't be applied to the resource itself as the point at which terraform must decide to replace a resource is before the provider has planned the change. See [this](hashicorp/terraform#31702 (comment)) for details. - `output`: This *can* be changed from string to dynamic (as for `body`) for most cases. Whilst it might cause fatal error when the API returns different model given different input (e.g. an update of the API model introduces a new attribute in the read afterwards). The reason can be found at [here](https://developer.hashicorp.com/terraform/plugin/framework/handling-data/dynamic-data#understanding-type-consistency). - `output_attrs`: As the `output` is stil a string, this attribute is still needed. There are also some remaining things to do: - The import spec now breaks as the `body` needs encode type. There needs a grammer for the `body` to define its fw type. - The test needs to update - The data source and operationr esource needs to update There are also inconvinience than the previous way of using string, e.g. `[1,2,3]` is by default of type tuple, which will cause inconsistency error when the tuple's length changed.
… up to type dynamic
…ate/update separately
magodo
changed the title
Change
resources - Change Apr 16, 2024
body
from string tpye to dynamic typebody
, delete_body
, output
from string tpye to dynamic type
…orts `$(body)` (#96)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 makes the following changes:
restful_resource
- Change the type ofbody
,output
from string to dynamicrestful_resource
-Read
invoked fromCreate
/Update
now won't update thebody
(but still update theoutput
). This makes those round trip inconsistent APIs won't cause error during theterraform apply
, which makes the resource as tainted. Instead it will show the diff in the nextterraform plan
, which brings a chance for users to add thewrite_only_attrs
/ignore_changes
restful_operation
- Change the type ofbody
,delete_body
,output
from string to dynamicrestful_resource
data source - Change the type ofoutput
from string to dynamicFix #83
Fix #91