Skip to content

Commit

Permalink
Exporter: don't emit databricks_permissions for /Shared directory
Browse files Browse the repository at this point in the history
Current Permissions API doesn't allow change of the permissions for the `/Shared` folder,
so when we generate a permission resource for it, we get Terraform error.

fixes #2269
  • Loading branch information
alexott committed May 10, 2023
1 parent 28cbf48 commit 395d688
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion exporter/importables.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ var resourcesMap map[string]importable = map[string]importable{
})
}

// TODO: it's not completely correct condition - we need to make emit smarter - emit only if permissions are different...
if ic.meAdmin {
ic.Emit(&resource{
Resource: "databricks_directory",
Expand Down Expand Up @@ -1677,6 +1678,7 @@ var resourcesMap map[string]importable = map[string]importable{
if strings.HasPrefix(directory.Path, "/Repos") {
continue
}
// TODO: don't emit directories for deleted users/SPs (how to identify them?)
ic.Emit(&resource{
Resource: "databricks_directory",
ID: directory.Path,
Expand All @@ -1693,7 +1695,8 @@ var resourcesMap map[string]importable = map[string]importable{
splits := strings.Split(r.Name, "_")
directoryId := splits[len(splits)-1]

if ic.meAdmin {
// Existing permissions API doesn't allow to set permissions for
if ic.meAdmin && r.ID != "/Shared" {
ic.Emit(&resource{
Resource: "databricks_permissions",
ID: fmt.Sprintf("/directories/%s", directoryId),
Expand Down

0 comments on commit 395d688

Please sign in to comment.