Commit f350081
direct: Add dashboards support (#3725)
## Summary
This PR adds support for **Databricks Lakeview Dashboards** in the
direct deployment mode (`DATABRICKS_BUNDLE_ENGINE=direct-exp`).
Dashboards can now be deployed, updated, and deleted directly via API
calls without using Terraform.
## Key Features
### 1. **Full Dashboard Lifecycle Management**
- **Create**: Creates draft dashboards and automatically publishes them
with warehouse and credential settings
- **Update**: Updates both dashboard content and publish settings
(warehouse_id, embed_credentials)
- **Delete**: Safely trashes dashboards with idempotent handling
- **Refresh**: Fetches dashboard state from both draft and published
endpoints in parallel
### 2. **Smart Field Change Detection**
The implementation uses `FieldTriggers` to determine the correct action
for each field change:
#### Update Actions (in-place modifications):
- `display_name` - Dashboard name changes
- `warehouse_id` - SQL warehouse assignment changes
- `embed_credentials` - Credential embedding toggle
- `serialized_dashboard` - Dashboard content/layout changes
#### Recreate Actions (delete + create):
- `parent_path` - Moving dashboard to different folder requires
recreation
#### Skip Actions (ignored for diff):
- Output-only fields: `dashboard_id`, `path`, `create_time`,
`update_time`, `lifecycle_state`
- `etag` - Skipped for local changes (user edits), but triggers updates
for remote drift detection
- `serialized_dashboard` - Skipped for remote drift (etag is sufficient)
### 3. **Advanced Capabilities**
**Parallel API Calls**: Refresh operations fetch both draft and
published dashboard states concurrently using goroutines for better
performance.
**Automatic Parent Directory Creation**: If the parent directory doesn't
exist, it's automatically created before dashboard creation.
**Idempotent Delete**: Handles already-trashed dashboards gracefully by
checking the dashboard state on 403 errors.
**embed_credentials Edge Case**: Unlike Terraform, this implementation
properly detects changes to the `embed_credentials` field by fetching
published dashboard state separately.
**Serialized Dashboard Flexibility**: Supports both string and
map/object formats for `serialized_dashboard` in bundle configuration.
### 4. **Comprehensive Test Coverage**
Added 5 new acceptance test suites testing field change behavior:
- `change-name` - Tests display_name updates
- `change-warehouse-id` - Tests warehouse assignment updates
- `change-embed-credentials` - Tests credential embedding toggle
- `change-serialized-dashboard` - Tests dashboard content updates
- `change-parent-path` - Tests parent path changes trigger recreate
Each test verifies:
- Correct API methods (POST/PATCH/DELETE) are called
- Dashboard ID changes (or doesn't change) as expected
- Field values are properly updated in remote state
## Testing
Existing and new unit and integration tests.
---------
Co-authored-by: Claude <[email protected]>1 parent a7e9ebd commit f350081
File tree
90 files changed
+1710
-74
lines changed- acceptance
- bundle
- generate/dashboard-inplace
- refschema
- resources/dashboards
- change-embed-credentials
- change-name
- change-parent-path
- change-serialized-dashboard
- delete-trashed-out-of-band
- destroy
- detect-change
- generate_inplace
- nested-folders
- publish-failure-cleans-up-dashboard
- simple_outside_bundle_root
- simple_syncroot
- simple
- bundle
- config/resources
- deploy/terraform
- direct
- dresources
- dstate
- statemgmt
- libs/testserver
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
90 files changed
+1710
-74
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
418 | 442 | | |
419 | 443 | | |
420 | 444 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments