Skip to content

Commit d1a3302

Browse files
authored
Docs: use tasks in the databricks_job examples (databricks#3097)
We had a number of places, including the main page, where we used old way of tasks specification instead of using `task` blocks, and that generated deprecation warning. This PR fixes that. Also run `make fmt-docs` to format Terraform code examples.
1 parent d3427f5 commit d1a3302

11 files changed

+69
-49
lines changed

docs/data-sources/current_user.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ resource "databricks_notebook" "this" {
3131
resource "databricks_job" "this" {
3232
name = "Terraform Demo (${data.databricks_current_user.me.alphanumeric})"
3333
34-
new_cluster {
35-
num_workers = 1
36-
spark_version = data.databricks_spark_version.latest.id
37-
node_type_id = data.databricks_node_type.smallest.id
38-
}
39-
40-
notebook_task {
41-
notebook_path = databricks_notebook.this.path
34+
task {
35+
task_key = "task1"
36+
37+
new_cluster {
38+
num_workers = 1
39+
spark_version = data.databricks_spark_version.latest.id
40+
node_type_id = data.databricks_node_type.smallest.id
41+
}
42+
43+
notebook_task {
44+
notebook_path = databricks_notebook.this.path
45+
}
4246
}
4347
}
4448

docs/guides/unity-catalog-azure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Each metastore exposes a 3-level namespace (catalog-schema-table) by which data
204204

205205
```hcl
206206
resource "databricks_catalog" "sandbox" {
207-
name = "sandbox"
207+
name = "sandbox"
208208
storage_root = format("abfss://%s@%s.dfs.core.windows.net",
209209
azurerm_storage_container.ext_storage.name,
210210
azurerm_storage_account.ext_storage.name)

docs/guides/workspace-management.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,18 @@ resource "databricks_notebook" "this" {
5757
resource "databricks_job" "this" {
5858
name = "Terraform Demo (${data.databricks_current_user.me.alphanumeric})"
5959
60-
new_cluster {
61-
num_workers = 1
62-
spark_version = data.databricks_spark_version.latest.id
63-
node_type_id = data.databricks_node_type.smallest.id
64-
}
60+
task {
61+
task_key = "task1"
62+
63+
new_cluster {
64+
num_workers = 1
65+
spark_version = data.databricks_spark_version.latest.id
66+
node_type_id = data.databricks_node_type.smallest.id
67+
}
6568
66-
notebook_task {
67-
notebook_path = databricks_notebook.this.path
69+
notebook_task {
70+
notebook_path = databricks_notebook.this.path
71+
}
6872
}
6973
}
7074

docs/index.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,18 @@ resource "databricks_notebook" "this" {
8484
resource "databricks_job" "this" {
8585
name = "Terraform Demo (${data.databricks_current_user.me.alphanumeric})"
8686
87-
new_cluster {
88-
num_workers = 1
89-
spark_version = data.databricks_spark_version.latest.id
90-
node_type_id = data.databricks_node_type.smallest.id
91-
}
92-
93-
notebook_task {
94-
notebook_path = databricks_notebook.this.path
87+
task {
88+
task_key = "task1"
89+
90+
notebook_task {
91+
notebook_path = databricks_notebook.this.path
92+
}
93+
94+
new_cluster {
95+
num_workers = 1
96+
spark_version = data.databricks_spark_version.latest.id
97+
node_type_id = data.databricks_node_type.smallest.id
98+
}
9599
}
96100
}
97101

docs/resources/catalog.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ A `databricks_catalog` is contained within [databricks_metastore](metastore.md)
1313

1414
```hcl
1515
resource "databricks_catalog" "sandbox" {
16-
name = "sandbox"
17-
comment = "this catalog is managed by terraform"
16+
name = "sandbox"
17+
comment = "this catalog is managed by terraform"
1818
properties = {
1919
purpose = "testing"
2020
}

docs/resources/grants.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ You can grant `ALL_PRIVILEGES`, `APPLY_TAG`, `CREATE_CONNECTION`, `CREATE_SCHEMA
5454

5555
```hcl
5656
resource "databricks_catalog" "sandbox" {
57-
name = "sandbox"
58-
comment = "this catalog is managed by terraform"
57+
name = "sandbox"
58+
comment = "this catalog is managed by terraform"
5959
properties = {
6060
purpose = "testing"
6161
}

docs/resources/mlflow_webhook.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@ resource "databricks_notebook" "this" {
3232
resource "databricks_job" "this" {
3333
name = "Terraform MLflowWebhook Demo (${data.databricks_current_user.me.alphanumeric})"
3434
35-
new_cluster {
36-
num_workers = 1
37-
spark_version = data.databricks_spark_version.latest.id
38-
node_type_id = data.databricks_node_type.smallest.id
39-
}
40-
41-
notebook_task {
42-
notebook_path = databricks_notebook.this.path
35+
task {
36+
task_key = "task1"
37+
38+
new_cluster {
39+
num_workers = 1
40+
spark_version = data.databricks_spark_version.latest.id
41+
node_type_id = data.databricks_node_type.smallest.id
42+
}
43+
44+
notebook_task {
45+
notebook_path = databricks_notebook.this.path
46+
}
4347
}
4448
}
4549

docs/resources/permissions.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,18 @@ resource "databricks_job" "this" {
181181
name = "Featurization"
182182
max_concurrent_runs = 1
183183
184-
new_cluster {
185-
num_workers = 300
186-
spark_version = data.databricks_spark_version.latest.id
187-
node_type_id = data.databricks_node_type.smallest.id
188-
}
184+
task {
185+
task_key = "task1"
186+
187+
new_cluster {
188+
num_workers = 300
189+
spark_version = data.databricks_spark_version.latest.id
190+
node_type_id = data.databricks_node_type.smallest.id
191+
}
189192
190-
notebook_task {
191-
notebook_path = "/Production/MakeFeatures"
193+
notebook_task {
194+
notebook_path = "/Production/MakeFeatures"
195+
}
192196
}
193197
}
194198

docs/resources/schema.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ A `databricks_schema` is contained within [databricks_catalog](catalog.md) and c
1313

1414
```hcl
1515
resource "databricks_catalog" "sandbox" {
16-
name = "sandbox"
17-
comment = "this catalog is managed by terraform"
16+
name = "sandbox"
17+
comment = "this catalog is managed by terraform"
1818
properties = {
1919
purpose = "testing"
2020
}

docs/resources/sql_table.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This resource creates and updates the Unity Catalog table/view by executing the
1313

1414
```hcl
1515
resource "databricks_catalog" "sandbox" {
16-
name = "sandbox"
17-
comment = "this catalog is managed by terraform"
16+
name = "sandbox"
17+
comment = "this catalog is managed by terraform"
1818
properties = {
1919
purpose = "testing"
2020
}

docs/resources/volume.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ This resource manages Volumes in Unity Catalog.
3737

3838
```hcl
3939
resource "databricks_catalog" "sandbox" {
40-
name = "sandbox"
41-
comment = "this catalog is managed by terraform"
40+
name = "sandbox"
41+
comment = "this catalog is managed by terraform"
4242
properties = {
4343
purpose = "testing"
4444
}

0 commit comments

Comments
 (0)