-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Correctly send workload_type fields in
databricks_cluster
to …
…allow users to disable usage in certain contexts (#3972) ## Changes Migration of the `databricks_cluster` resource to use the Go SDK introduced a regression in the handling of the `workload_type` attribute, used to control what use-cases are permitted for a cluster. This occurred because when moving to the Go SDK, by default, falsy values (e.g. `jobs = false` in `workload_type`) are not serialized when sent to the REST API. This PR fixes this by setting ForceSendFields in the nested `Client` structure whenever `workload_type` is specified. Ultimate behavior should be: ``` (no workload_type block) # -> usable in both jobs and notebooks workload_type { client { jobs = true notebook = true } } # -> usable in both jobs and notebooks workload_type { client { jobs = false } } # -> not usable in jobs because disabled, usable in notebooks because omitted and true by default ``` Fixes #3689. ## Tests Added an integration test to verify this behavior. I paused the integration test after disabling usage in jobs & notebooks, and I verified I wasn't able to attach the cluster to a notebook. - [ ] `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
86 additions
and
5 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
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
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