-
Notifications
You must be signed in to change notification settings - Fork 94
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
Investigate and Determine Computed-Only Block Behavior #214
Comments
Another potential item to consider is if there is any state issues when migrating between frameworks as the schema will be represented slightly differently to Terraform CLI. This may require manually verifying an applied SDKv2 resource state against a plan/apply with updated values from the new framework. |
That last comment seems related to #42. |
Reference: hashicorp/terraform-plugin-framework#214 Reference: hashicorp/terraform-plugin-sdk#819 Reference: hashicorp/terraform-plugin-sdk#201 As part of investigating some differences between sdk/v2 and framework, the individual sensitivity configuration offered by nested attributes in protocol version 6 is important to call out explicitly.
It looks like providers migrating from sdk/v2 to framework, but remaining on protocol version 5, do actually need something to be done here otherwise Terraform will report back One additional challenge here is that this situation can be non-trivial to catch for data sources via the acceptance testing framework today, because there are behavior differences between a data source having all known values in its configuration versus any unknowns, and because triggering this type of error requires a configuration reference to a nested attribute of the block. We have a few options (not necessarily mutually exclusive) with tradeoffs:
|
For what it is worth, I initially lean towards documenting this in the migration documentation (items one and two above). For most providers, I think the preference will be to go to protocol version 6 and nested attributes, which is fairly similar in implementation to read-only blocks in sdk/v2. I just wish there was a better way to try to catch this for provider developers migrating -- maybe the lack of the |
#76) Reference: hashicorp/terraform-plugin-framework#214 Reference: hashicorp/terraform-plugin-sdk#819 Reference: hashicorp/terraform-plugin-sdk#201 As part of investigating some differences between sdk/v2 and framework, the individual sensitivity configuration offered by nested attributes in protocol version 6 is important to call out explicitly.
Initial sdk/v2 to framework migration guide for this topic has been published: https://www.terraform.io/plugin/framework/migrating/attributes-blocks/blocks-computed |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Module version
Description
If/when block support is implemented (see also: #85), there may need to be an investigation into how
Computed
only blocks (or more technically accurate, where all block attributes areComputed
only) are documented or otherwise supported by the framework.In Terraform Plugin SDK version 2, there is special logic that automatically applied to
Computed
-only blocks that converts them into attributes:https://github.com/hashicorp/terraform-plugin-sdk/blob/9dad6ed9dc7845584ce20f1116c02a10863b1900/helper/schema/core_schema.go#L96-L101
While this has its own issues (see also: hashicorp/terraform-plugin-sdk#201) and likely would not be done in this framework since its design tends to avoid such unexpected abstraction/behavior changes, something may need to be done to prevent Terraform CLI "inconsistent results after apply" errors, if they occur, whether that be additional documentation, helpers, or other handling by the framework.
Definition of Done
terraform-provider-corner may be the most appropriate place to capture end-to-end testing scenarios, since any potential error would occur in Terraform CLI.
Computed
only attributes (replicate for set blocks as well)Computed
only attributes (replicate for nested set blocks as well)The text was updated successfully, but these errors were encountered: