-
Notifications
You must be signed in to change notification settings - Fork 397
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
[Internal] Use Attributes by default for List Objects #4315
Conversation
// ConfigureForSdkV2Migration modifies the underlying schema to be compatible with SDKv2. This method must | ||
// be called on all resources that were originally implemented using the SDKv2 and are migrated to the plugin | ||
// framework. | ||
func (s *CustomizableSchema) ConfigureForSdkV2Migration() *CustomizableSchema { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why, but for me ConfigureForSdkV2Migration
sends the message that it prepares it for a migration towards SDKv2, how about something with "compatibility", like MakeCompatibleWithSdkV2
or ConfigureAsSdkV2Compatible
?
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Test Details: go/deco-tests/12295047523 |
Note: the diff in schema on this PR is purely in data sources, converting block types to attributes for purely computed fields, in line with https://developer.hashicorp.com/terraform/plugin/framework/migrating/attributes-blocks/blocks-computed. There are no diffs in resource schemas. |
### New Features and Improvements * Add `databricks_app` resource and data source ([#4099](#4099)). ### Documentation * Add a warning that attribute should be used in `databricks_permissions` for `databricks_vector_search_endpoint` ([#4312](#4312)). ### Internal Changes * Added TF Plugin Framework checkbox item to PR template and removed checkbox for integration tests passing ([#4227](#4227)). * Expose several integration test helpers for use in plugin framework integration tests ([#4310](#4310)). * Fix ReadOnly() for ListNestedAttribute and Validators for ListNestedBlock ([#4313](#4313)). * Panic if the provided path is invalid ([#4309](#4309)). * Simplify `databricks_storage_credential` code ([#4301](#4301)). * Use Attributes by default for List Objects ([#4315](#4315)). * Use Plugin Framework types internally in generated TF SDK structures ([#4291](#4291)).
### New Features and Improvements * Add `databricks_app` resource and data source ([#4099](#4099)). ### Documentation * Add a warning that attribute should be used in `databricks_permissions` for `databricks_vector_search_endpoint` ([#4312](#4312)). ### Internal Changes * Added TF Plugin Framework checkbox item to PR template and removed checkbox for integration tests passing ([#4227](#4227)). * Expose several integration test helpers for use in plugin framework integration tests ([#4310](#4310)). * Fix ReadOnly() for ListNestedAttribute and Validators for ListNestedBlock ([#4313](#4313)). * Panic if the provided path is invalid ([#4309](#4309)). * Simplify `databricks_storage_credential` code ([#4301](#4301)). * Use Attributes by default for List Objects ([#4315](#4315)). * Use Plugin Framework types internally in generated TF SDK structures ([#4291](#4291)).
Changes
Resources implemented on the SDKv2 used blocks to represent two kinds of fields: traditional lists, and nested complex types (which were treated as a list of length at most 1). The Plugin Framework now has support for list attributes, and it is recommended to use this in general, except for places where compatibility with SDKv2 is needed.
To achieve this, this change ensures that *StructToSchema methods in the plugin framework generate attributes for lists by default. Then, for resources migrated from SDKv2, the implementer must call
ConfigureForSdkV2Migration()
in the customize callback. This will convert any list attributes into list blocks, preserving compatibility with SDKv2-implemented resources.Additionally, this PR improves the handling of computed, non-optional fields. For lists annotated as
tf:"computed"
, the resulting schema is invalid: it is marked as computed and as required because of the absence of the"optional"
tag. When a field is labeled as computed, it can be marked as optional but should never be marked as required; that is addressed here as well.Finally, this PR also includes some autogenerated changes modifying Apps to use
types.Object
in place oftypes.List
for nested complex types.Tests
make test
run locallydocs/
folderinternal/acceptance