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] Mark unity_catalog_provisioning_state as ReadOnly #4116

Merged

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Oct 16, 2024

Changes

In a recent update to the GoSDK, a new field called unity_catalog_provisioning_state was added. This field changes values based on server decisions, so it's supposed to be marked as computed. This pull request sorts out that issue.

Tests

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

@rauchy rauchy requested review from a team as code owners October 16, 2024 12:31
@rauchy rauchy requested review from mgyucht, tanmay-db and hectorcast-db and removed request for a team October 16, 2024 12:31
@@ -59,6 +59,7 @@ func ResourceOnlineTable() common.Resource {
common.CustomizeSchemaPath(m, "spec", "source_table_full_name").SetCustomSuppressDiff(common.EqualFoldDiffSuppress)
common.CustomizeSchemaPath(m, "name").SetRequired().SetForceNew()
common.CustomizeSchemaPath(m, "status").SetReadOnly()
common.CustomizeSchemaPath(m, "unity_catalog_provisioning_state").SetComputed()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to use .SetReadOnly() because it will set optional and required into correct states

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to add it to the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alex. Could you explain when it makes sense to use computed properties versus readonly properties?

Copy link
Contributor

@alexott alexott Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SetReadOnly function does a few things:

  • set Computed (doc) - same as SetComputed
  • It sets Required to false and Optional to true because Computed can't be used with Required.
  • Sets MinItems to 0...

In general, if the field is already Optional, both functions do the same, but SetReadOnly is just safer here because you don't need to check if the field already marked as optional or not.

@rauchy rauchy force-pushed the rauchy/mark-unity-catalog-provisioning-state-as-computed branch from dbd5a73 to f11f951 Compare October 16, 2024 12:42
@rauchy rauchy changed the title [Fix] Mark unity_catalog_provisioning_state as computed [Fix] Mark unity_catalog_provisioning_state as ReadOnly Oct 16, 2024
@rauchy rauchy force-pushed the rauchy/mark-unity-catalog-provisioning-state-as-computed branch from f11f951 to 25f1b6a Compare October 16, 2024 12:49
@rauchy rauchy enabled auto-merge October 16, 2024 12:49
@rauchy rauchy added this pull request to the merge queue Oct 16, 2024
Merged via the queue into main with commit 2bbf251 Oct 16, 2024
7 checks passed
@rauchy rauchy deleted the rauchy/mark-unity-catalog-provisioning-state-as-computed branch October 16, 2024 12:54
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