Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Data Source Lakeview Dashboards #4451

Open
jarpsimoes opened this issue Jan 30, 2025 · 0 comments
Open

[FEATURE] Data Source Lakeview Dashboards #4451

jarpsimoes opened this issue Jan 30, 2025 · 0 comments
Labels
feature New feature or request

Comments

@jarpsimoes
Copy link

jarpsimoes commented Jan 30, 2025

Data Source Dashboards

Implement Data Source that allow to get all the deployed dashboards from workspace.

Use-cases

The specific use case is when exists a IaC script to enforce permissions on each dashboard, sometimes the permissions needs be updated after deployment of dashboards. With the available resources is needed to use the http request in terraform:

data "http" "dashboards" {
  url        = "https://<workspace_url>/api/2.0/lakeview/dashboards"

  request_headers = {
    <...> (Auth Headers)
  }

  lifecycle {
    postcondition {
      condition     = contains([200], self.status_code)
      error_message = "Status code invalid"
    }
  }
}

Apply permissions:

resource "databricks_permissions" "dashboards_permissions" {
  for_each = jsondecode(data.http.dashboards.response_body).dashboards[*].dashboard_id

  dashboard_id = each.value

  access_control {
    group_name       = "Example Group"
    permission_level = "CAN_MANAGE"
  }
}

Proposal

The suitable case on that case is to following the approach that exists for pipelines.

data "databricks_dashboards" "all" {

}

resource "databricks_permissions" "dashboards_permissions" {
  depends = [ data.databricks_dashboards.all ]
  for_each = data.databricks_dashboards.ids

  dashboard_id = each.value

  access_control {
    group_name       = "Example Group"
    permission_level = "CAN_MANAGE"
  }
}
@jarpsimoes jarpsimoes added the feature New feature or request label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant