|
38 | 38 | gsRegex = regexp.MustCompile(`^gs://([^/]+)(/.*)?$`) |
39 | 39 | globalWorkspaceConfName = "global_workspace_conf" |
40 | 40 | notebookPathToIdRegex = regexp.MustCompile(`[^a-zA-Z0-9]+`) |
| 41 | + jobClustersRegex = regexp.MustCompile(`^((job_cluster|task)\.[0-9]+\.new_cluster\.[0-9]+\.)`) |
| 42 | + dltClusterRegex = regexp.MustCompile(`^(cluster\.[0-9]+\.)`) |
41 | 43 | ) |
42 | 44 |
|
43 | 45 | type dbsqlListResponse struct { |
@@ -297,6 +299,7 @@ var resourcesMap map[string]importable = map[string]importable{ |
297 | 299 | } |
298 | 300 | return ic.importLibraries(r.Data, s) |
299 | 301 | }, |
| 302 | + ShouldOmitField: makeShouldOmitFieldForCluster(nil), |
300 | 303 | }, |
301 | 304 | "databricks_job": { |
302 | 305 | ApiVersion: common.API_2_1, |
@@ -472,6 +475,16 @@ var resourcesMap map[string]importable = map[string]importable{ |
472 | 475 | } |
473 | 476 | return nil |
474 | 477 | }, |
| 478 | + ShouldOmitField: func(ic *importContext, pathString string, as *schema.Schema, d *schema.ResourceData) bool { |
| 479 | + switch pathString { |
| 480 | + case "url", "format": |
| 481 | + return true |
| 482 | + } |
| 483 | + if res := jobClustersRegex.FindStringSubmatch(pathString); res != nil { // analyze job clusters |
| 484 | + return makeShouldOmitFieldForCluster(jobClustersRegex)(ic, pathString, as, d) |
| 485 | + } |
| 486 | + return defaultShouldOmitFieldFunc(ic, pathString, as, d) |
| 487 | + }, |
475 | 488 | }, |
476 | 489 | "databricks_cluster_policy": { |
477 | 490 | Service: "compute", |
@@ -1349,7 +1362,14 @@ var resourcesMap map[string]importable = map[string]importable{ |
1349 | 1362 | }) |
1350 | 1363 | } |
1351 | 1364 | return nil |
1352 | | - }, Depends: []reference{ |
| 1365 | + }, |
| 1366 | + ShouldOmitField: func(ic *importContext, pathString string, as *schema.Schema, d *schema.ResourceData) bool { |
| 1367 | + if res := dltClusterRegex.FindStringSubmatch(pathString); res != nil { // analyze DLT clusters |
| 1368 | + return makeShouldOmitFieldForCluster(dltClusterRegex)(ic, pathString, as, d) |
| 1369 | + } |
| 1370 | + return defaultShouldOmitFieldFunc(ic, pathString, as, d) |
| 1371 | + }, |
| 1372 | + Depends: []reference{ |
1353 | 1373 | {Path: "creator_user_name", Resource: "databricks_user", Match: "user_name"}, |
1354 | 1374 | {Path: "cluster.aws_attributes.instance_profile_arn", Resource: "databricks_instance_profile"}, |
1355 | 1375 | {Path: "new_cluster.init_scripts.dbfs.destination", Resource: "databricks_dbfs_file"}, |
|
0 commit comments