databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
428 stars 368 forks source link

[ISSUE] Cannot set notifications for `databricks_sql_alert` #2121

Open amitca71 opened 1 year ago

amitca71 commented 1 year ago

Configuration

# Copy-paste your Terraform configuration here
resource "databricks_directory" "shared_dir" {
  path = "/Shared/Queries"
}

resource "databricks_sql_query" "this" {
  data_source_id = databricks_sql_endpoint.this.data_source_id
  name           = "v_tasks_without_source query"
  query          = "select count(*) as counter from  ${var.catalog}.operational.v_qry_qa_tasks_products_not_cycle_related_without_source"
  parent         = "folders/${databricks_directory.shared_dir.object_id}"
}

resource "databricks_sql_alert" "alert" {
  query_id = databricks_sql_query.this.id
  name     = "v_tasks_without_source alert"
  parent   = "folders/${databricks_directory.shared_dir.object_id}"
#  rearm    = 1
  options {
    column = "counter"
    op     = ">"
    value  = "0"
    muted  = var.alarm_muted
  }
}

Expected Behavior

following options are missing from terraform databricks_sql_alert (https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/sql_alert):

Notifications (e.g. are sent just once, until back to normal) Destinations (slack channels, mail configurations) Refresh (how often to refresh alert

Actual Behavior

Steps to Reproduce

look at documentation https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/sql_alert vs alert of databricks

Terraform and provider versions

Debug Output

Important Factoids

chandler1331 commented 1 year ago

In addition it is also missing the SQL warehouse configuration: Notifications (e.g. are sent just once, until back to normal) Destinations (slack channels, mail configurations) Refresh (how often to refresh alert) SQL Warehouse (Which endpoint to hit to run the query on the Alert)

mcblueshirt commented 1 year ago

Is there any update on when this will become available?

alexott commented 1 year ago

@mcblueshirt there is still no API for that - without API it's not possible.... Check API docs

jordache16 commented 1 year ago

We are wanting / needing this functionality as well. Right now we are creating the query via terraform and 'stubbing' in the alert for the query using Terraform and then are having to come into the UI to add the Notifications / Destination / Refresh info on the Alert which is not ideal.

If we are able to do this via the UI, there has to be an API somewhere on the backend that enables this functionality (maybe it's not the Alerts API: (api/2.0/preview/sql/alerts)

nkvuong commented 3 weeks ago

The notification destinations API just gets released into public preview - https://docs.databricks.com/api/workspace/notificationdestinations