You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Exporter] Added support for Database Instance resource (aka Lakebase) (#5212)
## Changes
<!-- Summary of your changes that are easy to understand -->
Also adding more generic functions, i.e. handle of effective fields,
etc.
## Tests
<!--
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->
- [x] `make test` run locally
- [x] relevant change in `docs/` folder
- [ ] covered with integration tests in `internal/acceptance`
- [x] using Go SDK
- [x] using TF Plugin Framework
- [x] has entry in `NEXT_CHANGELOG.md` file
Copy file name to clipboardExpand all lines: docs/guides/experimental-exporter.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -184,6 +184,7 @@ Services could be specified in combination with predefined aliases (`all` - for
184
184
*`groups` - **listing**[databricks_group](../data-sources/group.md) with [membership](../resources/group_member.md) and [data access](../resources/group_instance_profile.md). If Identity Federation is enabled on the workspace (when UC Metastore is attached), then account-level groups are exposed as data sources because they are defined on account level, and only workspace-level groups are exposed as resources. See the note above on how to perform migration between workspaces with Identity Federation enabled.
185
185
*`idfed` - **listing**[databricks_mws_permission_assignment](../resources/mws_permission_assignment.md) (account-level) and [databricks_permission_assignment](../resources/permission_assignment.md) (workspace-level). When listing is done on account level, you can filter assignment only to specific workspace IDs as specified by `-match`, `-matchRegex`, and `-excludeRegex` options. I.e., to export assignments only for two workspaces, use `-matchRegex '^1688808130562317|5493220389262917$'`.
186
186
*`jobs` - **listing**[databricks_job](../resources/job.md). Usually, there are more automated workflows than interactive clusters, so they get their own file in this tool's output. *Please note that workflows deployed and maintained via [Databricks Asset Bundles](https://docs.databricks.com/en/dev-tools/bundles/index.html) aren't exported!*
A reusable helper function (`exporter/util.go`) for resources that have input-only fields with corresponding `effective_*` fields. This pattern is common in resources where the API returns `effective_*` versions of input fields (e.g., `effective_node_count` for `node_count`).
93
+
94
+
**When to Use**:
95
+
- Your resource has input-only fields that are not returned by the API
96
+
- The API returns corresponding `effective_*` fields with the actual values
97
+
- You want to generate HCL with non-zero values from the `effective_*` fields
1. Checks if the field has a corresponding `effective_*` field in the schema
109
+
2. If found, applies smart filtering:
110
+
- Always includes required fields (even if zero value)
111
+
- Omits fields with zero values (`false`, `0`, `""`, etc.)
112
+
- Omits fields that match their default value
113
+
- Includes fields with non-zero values
114
+
3. Uses `reflect.ValueOf(v).IsZero()` for proper zero-value detection (important because `wrapper.GetOk()` returns `nonZero=true` even for `false` booleans)
115
+
116
+
**Prerequisites**:
117
+
Your resource's `Import` function must call `copyEffectiveFieldsToInputFieldsWithConverters[TfType](ic, r, GoSdkType{})` to copy values from `effective_*` fields to their input counterparts. See `exporter/impl_lakebase.go` for an example.
118
+
119
+
**Example**:
120
+
For a resource with `node_count` (input-only) and `effective_node_count` (API-returned):
121
+
- API returns: `{"effective_node_count": 2, "effective_enable_readable_secondaries": false}`
122
+
- Import function copies: `node_count = 2`, `enable_readable_secondaries = false`
0 commit comments