@@ -1526,17 +1526,13 @@ var resourcesMap map[string]importable = map[string]importable{
15261526 "notebook_" + ic .Importables ["databricks_notebook" ].Name (ic , r .Data ))
15271527 // TODO: it's not completely correct condition - we need to make emit smarter -
15281528 // emit only if permissions are different from their parent's permission.
1529- if ic .meAdmin {
1530- directorySplits := strings .Split (r .ID , "/" )
1531- directorySplits = directorySplits [:len (directorySplits )- 1 ]
1532- directoryPath := strings .Join (directorySplits , "/" )
1533-
1529+ if idx := strings .LastIndex (r .ID , "/" ); idx != - 1 {
1530+ directoryPath := r .ID [:idx ]
15341531 ic .Emit (& resource {
15351532 Resource : "databricks_directory" ,
15361533 ID : directoryPath ,
15371534 })
15381535 }
1539-
15401536 return r .Data .Set ("source" , fileName )
15411537 },
15421538 ShouldOmitField : shouldOmitMd5Field ,
@@ -1583,11 +1579,8 @@ var resourcesMap map[string]importable = map[string]importable{
15831579
15841580 // TODO: it's not completely correct condition - we need to make emit smarter -
15851581 // emit only if permissions are different from their parent's permission.
1586- if ic .meAdmin {
1587- directorySplits := strings .Split (r .ID , "/" )
1588- directorySplits = directorySplits [:len (directorySplits )- 1 ]
1589- directoryPath := strings .Join (directorySplits , "/" )
1590-
1582+ if idx := strings .LastIndex (r .ID , "/" ); idx != - 1 {
1583+ directoryPath := r .ID [:idx ]
15911584 ic .Emit (& resource {
15921585 Resource : "databricks_directory" ,
15931586 ID : directoryPath ,
@@ -2072,9 +2065,7 @@ var resourcesMap map[string]importable = map[string]importable{
20722065 if r .ID == "/Shared" || r .ID == "/Users" || ic .IsUserOrServicePrincipalDirectory (r .ID , "/Users" , true ) {
20732066 r .Mode = "data"
20742067 }
2075-
20762068 return nil
2077-
20782069 },
20792070 Body : resourceOrDataBlockBody ,
20802071 Depends : []reference {
0 commit comments