-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Fix
databricks_sql_table
treatment of properties (#3925)
## Changes `databricks_sql_table` has been difficult to maintain due to the fact that Databricks adds table properties and options that users haven't directly configured. Historically, to handle this, we have tried to construct properties carefully by tracking which properties are added by Databricks automatically and removing them. This has two challenges: 1. We don't know ahead of time which properties are set by Databricks, so we don't know which properties we need to remove to compute an accurate diff. 2. Users are not able to specify different values for those default properties: they are hidden from the `serializeProperties()` and `serializeOptions()` functions in the resource implementation. This PR takes a different approach for handling these fields by storing the properties/options returned by the API in `effective_properties` and `effective_options` fields, respectively. These fields are computed and non-user-settable, so users cannot override them. When creating/updating the table, we only include the properties specified by the user. However, when determining if there is a diff, we compare the effective properties fetched by the `terraform plan` triggering an update of the table state with the user-specified properties. If the user specified any properties that are not part of the effective properties/options, or if the user's value clashes with the value provided, this will trigger a diff. However, if a non-user-specified property has a difference, then that does not trigger a diff. As a side-effect, this PR also fixes the treatment of `TBLPROPERTIES` and `OPTIONS` as reported in #3894. It also makes the `properties` field not computed, fixing #3652. It also allows users to override properties that are otherwise set by default, fixing #2800. Fixes #3894. Fixes #3652. Fixes #3378. Fixes #2800. ## Tests Unit tests to verify the diff behavior with this change. Unit test to ensure that TBLPROPERTIES is correctly set. - [ ] `make test` run locally - [ ] relevant change in `docs/` folder - [ ] covered with integration tests in `internal/acceptance` - [ ] relevant acceptance tests are passing - [ ] using Go SDK
- Loading branch information
Showing
3 changed files
with
313 additions
and
101 deletions.
There are no files selected for viewing
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
Oops, something went wrong.