Skip to content

Commit eb3bf25

Browse files
authored
Exporter: don't export storage when databricks_pipeline was created with default value (#2203)
When `storage` isn't specified in DLT pipeline, then DLT service generates a unique location on DBFS, but it's not portable, and should be ignored...
1 parent c81812c commit eb3bf25

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

exporter/importables.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var (
4747
predefinedClusterPolicies = []string{"Personal Compute", "Job Compute", "Power User Compute", "Shared Compute"}
4848
secretPathRegex = regexp.MustCompile(`^\{\{secrets\/([^\/]+)\/([^}]+)\}\}$`)
4949
sqlParentRegexp = regexp.MustCompile(`^folders/(\d+)$`)
50+
dltDefaultStorageRegex = regexp.MustCompile(`^dbfs:/pipelines/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`)
5051
)
5152

5253
func generateMountBody(ic *importContext, body *hclwrite.Body, r *resource) error {
@@ -1613,6 +1614,9 @@ var resourcesMap map[string]importable = map[string]importable{
16131614
if res := dltClusterRegex.FindStringSubmatch(pathString); res != nil { // analyze DLT clusters
16141615
return makeShouldOmitFieldForCluster(dltClusterRegex)(ic, pathString, as, d)
16151616
}
1617+
if pathString == "storage" {
1618+
return dltDefaultStorageRegex.FindStringSubmatch(d.Get("storage").(string)) != nil
1619+
}
16161620
return pathString == "creator_user_name" || defaultShouldOmitFieldFunc(ic, pathString, as, d)
16171621
},
16181622
Depends: []reference{

exporter/test-data/get-dlt-pipeline.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
],
5050
"name": "Test DLT",
5151
"photon": false,
52-
"storage": "/tmp/test",
52+
"storage": "dbfs:/pipelines/9ab12322-ccef-4539-8bf1-a43a95667dac",
5353
"target": "test"
5454
},
5555
"state": "IDLE"

0 commit comments

Comments
 (0)