Skip to content

Commit a604d6b

Browse files
authored
Merge branch 'main' into fix/issue-4692
2 parents 8550ae7 + cdd008b commit a604d6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2429
-160
lines changed

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e2018bb00cba203508f8afe5a6d41bd49789ba25
1+
59c4c0f3d5f0ef00cd5350b5674e941a7606d91a

.release_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"timestamp": "2025-10-30 14:12:51+0000"
2+
"timestamp": "2025-11-06 13:49:08+0000"
33
}

AGENTS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,45 @@ Resources are being migrated from SDKv2 to Plugin Framework. When migrating:
9595
- `TestMwsAcc*` - Account-level tests across all clouds
9696
- `TestUcAcc*` - Unity Catalog tests across all clouds
9797

98+
### Exporter Architecture
99+
100+
The exporter (`exporter/` directory) generates Terraform configuration (`.tf` files) and import scripts from existing Databricks resources.
101+
102+
#### Unified HCL Code Generation
103+
104+
The exporter uses a **unified code generation approach** for both SDKv2 and Plugin Framework resources:
105+
106+
**Entry Point**: `unifiedDataToHcl()` in `exporter/codegen.go`
107+
- Works with both SDKv2 and Plugin Framework resources through abstraction layers
108+
- Uses `ResourceDataWrapper` and `SchemaWrapper` interfaces for unified data access
109+
- Extracts ~70% of common logic into shared helper functions
110+
111+
**Architecture**:
112+
```
113+
unifiedDataToHcl()
114+
├── extractFieldsForGeneration() ← Shared: field iteration, omission, variable refs, skip logic
115+
├── generateSdkv2Field() ← SDKv2-specific: generates blocks
116+
├── generatePluginFrameworkField() ← Plugin Framework-specific: generates attributes
117+
└── generateDependsOnAttribute() ← Shared: depends_on generation
118+
```
119+
120+
**Resource Definition Callbacks** (`importable` struct in `exporter/model.go`):
121+
- `ShouldOmitFieldUnified` - Unified callback for field omission (works with both frameworks)
122+
- `ShouldGenerateFieldUnified` - Unified callback for field generation (works with both frameworks)
123+
- `ShouldOmitField` - Legacy SDKv2-only callback (deprecated, use Unified version)
124+
- `ShouldGenerateField` - Legacy SDKv2-only callback (deprecated, use Unified version)
125+
126+
**Key Differences**:
127+
- SDKv2 generates nested structures as **blocks**: `evaluation { ... }`
128+
- Plugin Framework generates nested structures as **attributes**: `evaluation = { ... }`
129+
130+
**When Adding Exporter Support**:
131+
1. Define resource in `exporter/importables.go` with `PluginFramework: true` for Plugin Framework resources
132+
2. Implement `List` function to discover resources
133+
3. Implement `Import` function to emit dependencies (use `convertPluginFrameworkToGoSdk` helper for Plugin Framework)
134+
4. Define `Depends` relationships for cross-resource references
135+
5. Use unified callbacks (`ShouldOmitFieldUnified`, `ShouldGenerateFieldUnified`) for custom field logic
136+
98137
### Dual-Provider Resource Patterns
99138

100139
#### Import Handling for Account/Workspace Resources

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Version changelog
22

3+
## Release v1.97.0 (2025-11-06)
4+
5+
### Bug Fixes
6+
7+
* Fixed spurious diffs in `databricks_model_serving` and `databricks_model_serving_provisioned_throughput` resources when the API returns `served_models` or `served_entities` in a different order than specified in the configuration ([#5188](https://github.com/databricks/terraform-provider-databricks/pull/5188)).
8+
9+
### Documentation
10+
11+
* Explain that special characters in URLs should be percent-encoded ([#5178](https://github.com/databricks/terraform-provider-databricks/pull/5178)).
12+
* Improve documentation about `preloaded_docker_images.basic_auth` in `databricks_cluster` and `databricks_instance_pool` ([#5154](https://github.com/databricks/terraform-provider-databricks/pull/5154)).
13+
14+
### Exporter
15+
16+
* Support exporting of `databricks_mws_ncc_binding` ([#5184](https://github.com/databricks/terraform-provider-databricks/pull/5184)).
17+
* Initial support for resources implemented with plugin framework ([#5176](https://github.com/databricks/terraform-provider-databricks/pull/5176)).
18+
19+
### Internal Changes
20+
* Add client support in CustomizeDiff for SDKv2 resources and data sources ([#5171](https://github.com/databricks/terraform-provider-databricks/pull/5171)).
21+
22+
323
## Release v1.96.0 (2025-10-30)
424

525
### New Features and Improvements

NEXT_CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NEXT CHANGELOG
22

3-
## Release v1.97.0
3+
## Release v1.98.0
44

55
### Breaking Changes
66

access/resource_permission_assignment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ func ResourcePermissionAssignment() common.Resource {
148148
})
149149
return common.Resource{
150150
Schema: s,
151-
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
152-
return common.NamespaceCustomizeDiff(d)
151+
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
152+
return common.NamespaceCustomizeDiff(ctx, d, c)
153153
},
154154
Create: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
155155
c, err := c.DatabricksClientForUnifiedProvider(ctx, d)

catalog/resource_catalog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func ResourceCatalog() common.Resource {
216216
}
217217
return w.Catalogs.Delete(ctx, catalog.DeleteCatalogRequest{Force: force, Name: d.Id()})
218218
},
219-
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
219+
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
220220
// The only scenario in which we can update options is for the `authorized_paths` key. Any
221221
// other changes to the options field will result in an error.
222222
if d.HasChange("options") {

catalog/resource_sql_table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ func ResourceSqlTable() common.Resource {
611611
tableSchema := common.StructToSchema(SqlTableInfo{}, nil)
612612
return common.Resource{
613613
Schema: tableSchema,
614-
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
614+
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
615615
if d.HasChange("column") {
616616
var newTableStruct SqlTableInfo
617617
common.DiffToStructPointer(d, tableSchema, &newTableStruct)

catalog/resource_table.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func ResourceTable() common.Resource {
7878
"view_definition", "comment", "properties"})
7979
return common.Resource{
8080
Schema: tableSchema,
81-
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
81+
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
8282
if d.Get("table_type") != "EXTERNAL" {
8383
return nil
8484
}

clusters/resource_cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const (
3131

3232
func ResourceCluster() common.Resource {
3333
return common.Resource{
34-
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff) error {
35-
return common.NamespaceCustomizeDiff(d)
34+
CustomizeDiff: func(ctx context.Context, d *schema.ResourceDiff, c *common.DatabricksClient) error {
35+
return common.NamespaceCustomizeDiff(ctx, d, c)
3636
},
3737
Create: resourceClusterCreate,
3838
Read: resourceClusterRead,

0 commit comments

Comments
 (0)