diff --git a/docs/resources/alert.md b/docs/resources/alert.md index 52d5f1b3f..478090892 100644 --- a/docs/resources/alert.md +++ b/docs/resources/alert.md @@ -77,7 +77,11 @@ In addition to all the arguments above, the following attributes are exported: ## Migrating from `databricks_sql_alert` resource -Under the hood, the new resource uses the same data as the `databricks_sql_alert`, but is exposed via a different API. This means that we can migrate existing alerts without recreating them. This operation is done in few steps: +Under the hood, the new resource uses the same data as the `databricks_sql_alert`, but is exposed via a different API. This means that we can migrate existing alerts without recreating them. + +-> It's also recommended to migrate to the `databricks_query` resource - see [databricks_query](query.md) for more details. + +This operation is done in few steps: * Record the ID of existing `databricks_sql_alert`, for example, by executing the `terraform state show databricks_sql_alert.alert` command. * Create the code for the new implementation by performing the following changes: @@ -109,7 +113,7 @@ we'll have a new resource defined as: ```hcl resource "databricks_alert" "alert" { - query_id = databricks_sql_query.this.id + query_id = databricks_query.this.id display_name = "My Alert" parent_path = databricks_directory.shared_dir.path condition { @@ -205,6 +209,6 @@ terraform import databricks_alert.this The following resources are often used in the same context: -* [databricks_sql_query](sql_query.md) to manage Databricks SQL [Queries](https://docs.databricks.com/sql/user/queries/index.html). -* [databricks_sql_endpoint](sql_endpoint.md) to manage Databricks SQL [Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html). +* [databricks_query](query.md) to manage [Databricks SQL Queries](https://docs.databricks.com/sql/user/queries/index.html). +* [databricks_sql_endpoint](sql_endpoint.md) to manage [Databricks SQL Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html). * [databricks_directory](directory.md) to manage directories in [Databricks Workpace](https://docs.databricks.com/workspace/workspace-objects.html). diff --git a/docs/resources/job.md b/docs/resources/job.md index efc6bd8ca..97f345761 100644 --- a/docs/resources/job.md +++ b/docs/resources/job.md @@ -224,14 +224,14 @@ One of the `query`, `dashboard` or `alert` needs to be provided. * `warehouse_id` - (Required) ID of the (the [databricks_sql_endpoint](sql_endpoint.md)) that will be used to execute the task. Only Serverless & Pro warehouses are supported right now. * `parameters` - (Optional) (Map) parameters to be used for each run of this task. The SQL alert task does not support custom parameters. -* `query` - (Optional) block consisting of single string field: `query_id` - identifier of the Databricks SQL Query ([databricks_sql_query](sql_query.md)). +* `query` - (Optional) block consisting of single string field: `query_id` - identifier of the Databricks Query ([databricks_query](query.md)). * `dashboard` - (Optional) block consisting of following fields: * `dashboard_id` - (Required) (String) identifier of the Databricks SQL Dashboard [databricks_sql_dashboard](sql_dashboard.md). * `subscriptions` - (Optional) a list of subscription blocks consisting out of one of the required fields: `user_name` for user emails or `destination_id` - for Alert destination's identifier. * `custom_subject` - (Optional) string specifying a custom subject of email sent. * `pause_subscriptions` - (Optional) flag that specifies if subscriptions are paused or not. * `alert` - (Optional) block consisting of following fields: - * `alert_id` - (Required) (String) identifier of the Databricks SQL Alert. + * `alert_id` - (Required) (String) identifier of the Databricks Alert ([databricks_alert](alert.md)). * `subscriptions` - (Optional) a list of subscription blocks consisting out of one of the required fields: `user_name` for user emails or `destination_id` - for Alert destination's identifier. * `pause_subscriptions` - (Optional) flag that specifies if subscriptions are paused or not. * `file` - (Optional) block consisting of single string fields: diff --git a/docs/resources/query.md b/docs/resources/query.md index 77fe8c915..cc8bc90ed 100644 --- a/docs/resources/query.md +++ b/docs/resources/query.md @@ -190,6 +190,6 @@ terraform import databricks_query.this The following resources are often used in the same context: -* [databricks_sql_query](sql_query.md) to manage Databricks SQL [Queries](https://docs.databricks.com/sql/user/queries/index.html). -* [databricks_sql_endpoint](sql_endpoint.md) to manage Databricks SQL [Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html). +* [databricks_alert](alert.md) to manage [Databricks SQL Alerts](https://docs.databricks.com/en/sql/user/alerts/index.html). +* [databricks_sql_endpoint](sql_endpoint.md) to manage [Databricks SQL Endpoints](https://docs.databricks.com/sql/admin/sql-endpoints.html). * [databricks_directory](directory.md) to manage directories in [Databricks Workpace](https://docs.databricks.com/workspace/workspace-objects.html). diff --git a/internal/acceptance/permissions_test.go b/internal/acceptance/permissions_test.go index 7c347b95e..2033a100a 100644 --- a/internal/acceptance/permissions_test.go +++ b/internal/acceptance/permissions_test.go @@ -841,20 +841,20 @@ func TestAccPermissions_ServingEndpoint(t *testing.T) { func TestAccPermissions_Alert(t *testing.T) { loadDebugEnvIfRunsFromIDE(t, "workspace") alertTemplate := ` - resource "databricks_sql_query" "this" { - name = "{var.STICKY_RANDOM}-query" - query = "SELECT 1 AS p1, 2 as p2" - data_source_id = "{env.TEST_DEFAULT_WAREHOUSE_DATASOURCE_ID}" + resource "databricks_query" "this" { + display_name = "{var.STICKY_RANDOM}-query" + query_text = "SELECT 1 AS p1, 2 as p2" + warehouse_id = "{env.TEST_DEFAULT_WAREHOUSE_ID}" } resource "databricks_alert" "this" { - query_id = databricks_sql_query.this.id + query_id = databricks_query.this.id display_name = "{var.STICKY_RANDOM}-alert" condition { op = "GREATER_THAN" operand { column { - name = "value" + name = "p1" } } threshold {