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

[Fix] Fix databricks_cluster_pluginframework data source #4097

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Oct 11, 2024

Changes

After bac842d , the autogenerated structures used for interacting with state/config/plan always use Lists for nested structures, even if there is only ever at most one, for compatibility with older versions of the TF provider. The cluster data source on the plugin framework is handwritten and also needs to be converted to use lists instead of a pointer as well.

Tests

Ran the TestAccDataSourceClusterByID and TestAccDataSourceClusterByName integration tests, which now pass.

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@mgyucht mgyucht requested review from a team as code owners October 11, 2024 10:19
@mgyucht mgyucht requested review from rauchy and removed request for a team October 11, 2024 10:19
@alexott
Copy link
Contributor

alexott commented Oct 11, 2024

Why can't we do such a conversion automatically? It makes it harder for people to port existing code - I've got the same problem with the registered model data source yesterday...

@mgyucht
Copy link
Contributor Author

mgyucht commented Oct 11, 2024

That's a good question @alexott. Unfortunately we have to do it this way because the issue arises when calling the Get() method on tfsdk.Value types like req.Plan/req.Config/req.State in order to preserve compatibility with current resources. SDKv2 only supports list-like data structures for nested structure attributes, but the plugin framework is more flexible. So, any resources that are being migrated need to use lists for nested structure attributes, otherwise it would be a breaking change.

The error we're seeing is what happens when calling Value.Get() with a non-list attribute when the schema indicates a list. You could work around this by defining a second data type with a list in place of the pointer, but that seems like overkill to me.

Note that this conversion is handled automatically by the GoToTfSDk/TfSDKToGo converters.

@mgyucht mgyucht added this pull request to the merge queue Oct 11, 2024
Merged via the queue into main with commit e1c683f Oct 11, 2024
9 checks passed
@mgyucht mgyucht deleted the fix-pluginframework-clusters-data-source branch October 11, 2024 11:37
hectorcast-db added a commit that referenced this pull request Oct 17, 2024
### New Features and Improvements

 * Add `databricks_registered_model` data source ([#4033](#4033)).
 * Add data source `databricks_notification_destinations` ([#4087](#4087)).

### Bug Fixes

 * Fix databricks_cluster_pluginframework data source ([#4097](#4097)).
 * Mark unity_catalog_provisioning_state as ReadOnly ([#4116](#4116)).
 * Tolerate invalid keys in `databricks_workspace_conf` ([#4102](#4102)).
 * force send `read_only` in `databricks_external_location` when it's changed ([#4067](#4067)).
 * force send `read_only` in `databricks_storage_credential` when it's changed ([#4083](#4083)).

### Documentation

 * Document `budget_policy_id` in `databricks_pipeline` and `databricks_job` ([#4110](#4110)).
 * Reformat code examples in documentation ([#4081](#4081)).
 * Update documentation for `databricks_model_serving` ([#4115](#4115)).
 * Updates to resource examples ([#4093](#4093)).

### Internal Changes

 * Add maxItem=1 validator for object types in plugin framework schema ([#4094](#4094)).
 * Fix acceptance test for `databricks_registered_model` data source ([#4105](#4105)).
 * Generate Effective Fields ([#4057](#4057)).
 * Generate Effective Fields ([#4112](#4112)).
 * Set SDK used in the useragent in context ([#4092](#4092)).
 * Support adding context in resources and data sources ([#4085](#4085)).
 * Update plugin framework schema to use ListNestedBlocks ([#4040](#4040)).
github-merge-queue bot pushed a commit that referenced this pull request Oct 18, 2024
### New Features and Improvements

* Add `databricks_registered_model` data source
([#4033](#4033)).
* Add data source `databricks_notification_destinations`
([#4087](#4087)).


### Bug Fixes

* Fix databricks_cluster_pluginframework data source
([#4097](#4097)).
* Mark unity_catalog_provisioning_state as ReadOnly
([#4116](#4116)).
* Tolerate invalid keys in `databricks_workspace_conf`
([#4102](#4102)).
* force send `read_only` in `databricks_external_location` when it's
changed
([#4067](#4067)).
* force send `read_only` in `databricks_storage_credential` when it's
changed
([#4083](#4083)).


### Documentation

* Document `budget_policy_id` in `databricks_pipeline` and
`databricks_job`
([#4110](#4110)).
* Reformat code examples in documentation
([#4081](#4081)).
* Update documentation for `databricks_model_serving`
([#4115](#4115)).
* Updates to resource examples
([#4093](#4093)).


### Internal Changes

* Add maxItem=1 validator for object types in plugin framework schema
([#4094](#4094)).
* Fix acceptance test for `databricks_registered_model` data source
([#4105](#4105)).
* Generate Effective Fields
([#4057](#4057)).
* Generate Effective Fields
([#4112](#4112)).
* Set SDK used in the useragent in context
([#4092](#4092)).
* Support adding context in resources and data sources
([#4085](#4085)).
* Update plugin framework schema to use ListNestedBlocks
([#4040](#4040)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants