Skip to content

Commit 4832603

Browse files
committed
adding file for azure and example
1 parent 8a5d300 commit 4832603

File tree

21 files changed

+185
-162
lines changed

21 files changed

+185
-162
lines changed

examples/all/sample-maximum_config/main.tf

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ terraform {
1616
module "databricks_workspace_management" {
1717
source = "../../../"
1818

19-
workspace_url = "https://<workspace_url>.cloud.databricks.com"
20-
dapi_token = "dapi1234567890"
2119
# ------------------------------------------------
2220
# CLUSTER
2321
# ------------------------------------------------

examples/all/sample/main.tf

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ terraform {
1616
module "databricks_workspace_management" {
1717
source = "../../../"
1818

19-
workspace_url = "https://<workspace_url>.cloud.databricks.com"
20-
dapi_token = "dapi1234567890"
21-
# ------------------------------------------------
2219
deploy_cluster = true
2320
deploy_jobs = true
2421
local_notebooks = [

examples/jobs/1_job_on_new_cluster_with_new_and_existing_notebooks/main.tf

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ terraform {
1515

1616
module "databricks_workspace_management" {
1717
source = "../../../"
18-
19-
workspace_url = var.workspace_url
20-
dapi_token = var.dapi_token
2118
# ------------------------------------------------
2219
# JOB
2320
# ------------------------------------------------

examples/jobs/1_job_on_new_cluster_with_new_and_existing_notebooks/outputs.tf

+4-29
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,17 @@ output "notebook_url" {
77
description = "databricks notebook url"
88
value = module.databricks_workspace_management.notebook_url
99
}
10-
output "new_cluster_new_job_new_notebooks_job" {
10+
output "job_url" {
1111
description = "databricks job url"
1212
value = module.databricks_workspace_management.new_cluster_new_job_new_notebooks_job
1313
}
1414

15-
output "new_cluster_new_job_new_notebooks_id" {
15+
output "job_id" {
1616
description = "databricks job id"
1717
value = module.databricks_workspace_management.new_cluster_new_job_new_notebooks_id
1818
}
1919

20-
output "existing_cluster_new_job_new_notebooks_job" {
21-
description = "databricks new cluster job url"
22-
value = module.databricks_workspace_management.existing_cluster_new_job_new_notebooks_job
23-
}
24-
25-
output "existing_cluster_new_job_new_notebooks_id" {
26-
description = "databricks new cluster job id"
27-
value = module.databricks_workspace_management.existing_cluster_new_job_new_notebooks_id
28-
}
29-
30-
output "new_cluster_new_job_existing_notebooks_job" {
31-
description = "databricks job url"
32-
value = module.databricks_workspace_management.new_cluster_new_job_existing_notebooks_job
33-
}
34-
35-
output "new_cluster_new_job_existing_notebooks_id" {
36-
description = "databricks job id"
20+
output "notebooks_id" {
21+
description = "databricks notebook id"
3722
value = module.databricks_workspace_management.new_cluster_new_job_existing_notebooks_id
3823
}
39-
40-
output "existing_cluster_new_job_existing_notebooks_job" {
41-
description = "databricks new cluster job url"
42-
value = module.databricks_workspace_management.existing_cluster_new_job_existing_notebooks_job
43-
}
44-
45-
output "existing_cluster_new_job_existing_notebooks_id" {
46-
description = "databricks new cluster job id"
47-
value = module.databricks_workspace_management.existing_cluster_new_job_existing_notebooks_id
48-
}

examples/jobs/2_job_on_existing_cluster_with_new_notebooks/outputs.tf

-44
This file was deleted.

examples/jobs/2_job_on_existing_cluster_with_new_notebooks/main.tf renamed to examples/jobs/2_job_on_new_cluster_with_new_and_existing_notebooks_without_acl/main.tf

+7-22
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ terraform {
1515

1616
module "databricks_workspace_management" {
1717
source = "../../../"
18-
19-
workspace_url = var.workspace_url
20-
dapi_token = var.dapi_token
2118
# ------------------------------------------------
2219
# JOB
2320
# ------------------------------------------------
2421
deploy_jobs = true
25-
cluster_id = "0907-052446-bike152"
22+
deploy_cluster = true
2623
fixed_value = 1
2724
retry_on_timeout = false
2825
max_retries = 3
@@ -45,15 +42,6 @@ module "databricks_workspace_management" {
4542
on_success = ["[email protected]"]
4643
}
4744
# ------------------------------------------------
48-
# JOB ACCESS CONTROL
49-
# ------------------------------------------------
50-
jobs_access_control = [
51-
{
52-
group_name = "demo"
53-
permission_level = "CAN_MANAGE_RUN"
54-
}
55-
]
56-
# ------------------------------------------------
5745
# NOTEBOOK
5846
# ------------------------------------------------
5947
local_notebooks = [
@@ -68,15 +56,12 @@ module "databricks_workspace_management" {
6856
local_path = "notebooks/sample2.py"
6957
}
7058
]
71-
# ------------------------------------------------
72-
# NOTEBOOK ACCESS CONTROL
73-
# ------------------------------------------------
74-
notebooks_access_control = [
75-
{
76-
group_name = "demo"
77-
permission_level = "CAN_READ"
78-
}
79-
]
59+
# remote_notebooks = [
60+
# {
61+
# job_name = "remote_demo_job"
62+
# path = "/Shared/demo/sample1.py"
63+
# }
64+
# ]
8065
# ------------------------------------------------
8166
# Do not change the teamid, prjid once set.
8267
teamid = var.teamid
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
token = dbutils.secrets.get('${databricks_secret_scope.this.name}', '${databricks_secret.token.key}')
2+
print(f'This should be redacted: {token}')
3+
print(f'Hello world - today is holiday')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
token = dbutils.secrets.get('${databricks_secret_scope.this.name}', '${databricks_secret.token.key}')
2+
print(f'This should be recacted: {token}')
3+
print(f'Hello world')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
output "cluster_id" {
2+
description = "databricks cluster id"
3+
value = module.databricks_workspace_management.cluster_id
4+
}
5+
6+
output "notebook_url" {
7+
description = "databricks notebook url"
8+
value = module.databricks_workspace_management.notebook_url
9+
}
10+
output "job_url" {
11+
description = "databricks job url"
12+
value = module.databricks_workspace_management.new_cluster_new_job_new_notebooks_job
13+
}
14+
15+
output "job_id" {
16+
description = "databricks job id"
17+
value = module.databricks_workspace_management.new_cluster_new_job_new_notebooks_id
18+
}
19+
20+
output "notebooks_id" {
21+
description = "databricks notebook id"
22+
value = module.databricks_workspace_management.new_cluster_new_job_existing_notebooks_id
23+
}

examples/jobs/3_job_on_existing_cluster_with_existing_notebooks/main.tf

+1-13
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@ terraform {
1414

1515
module "databricks_workspace_management" {
1616
source = "../../../"
17-
18-
workspace_url = var.workspace_url
19-
dapi_token = var.dapi_token
2017
# ------------------------------------------------
2118
# JOB
2219
# ------------------------------------------------
2320
deploy_jobs = true
24-
cluster_id = "0907-052446-bike152"
25-
# ------------------------------------------------
26-
# JOB ACCESS CONTROL
27-
# ------------------------------------------------
28-
jobs_access_control = [
29-
{
30-
group_name = "demo"
31-
permission_level = "CAN_MANAGE_RUN"
32-
}
33-
]
21+
cluster_id = "0609-190359-dbzlwtsp"
3422
# ------------------------------------------------
3523
# NOTEBOOK
3624
# ------------------------------------------------

examples/jobs/3_job_on_existing_cluster_with_existing_notebooks/outputs.tf

+3-33
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,12 @@ output "notebook_url" {
33
value = module.databricks_workspace_management.notebook_url
44
}
55

6-
output "new_cluster_new_job_new_notebooks_job" {
7-
description = "databricks job url"
8-
value = module.databricks_workspace_management.new_cluster_new_job_new_notebooks_job
9-
}
10-
11-
output "new_cluster_new_job_new_notebooks_id" {
12-
description = "databricks job id"
13-
value = module.databricks_workspace_management.new_cluster_new_job_new_notebooks_id
14-
}
15-
16-
output "existing_cluster_new_job_new_notebooks_job" {
17-
description = "databricks new cluster job url"
18-
value = module.databricks_workspace_management.existing_cluster_new_job_new_notebooks_job
19-
}
20-
21-
output "existing_cluster_new_job_new_notebooks_id" {
22-
description = "databricks new cluster job id"
23-
value = module.databricks_workspace_management.existing_cluster_new_job_new_notebooks_id
24-
}
25-
26-
output "new_cluster_new_job_existing_notebooks_job" {
27-
description = "databricks job url"
28-
value = module.databricks_workspace_management.new_cluster_new_job_existing_notebooks_job
29-
}
30-
31-
output "new_cluster_new_job_existing_notebooks_id" {
32-
description = "databricks job id"
33-
value = module.databricks_workspace_management.new_cluster_new_job_existing_notebooks_id
34-
}
35-
36-
output "existing_cluster_new_job_existing_notebooks_job" {
6+
output "job_url" {
377
description = "databricks new cluster job url"
388
value = module.databricks_workspace_management.existing_cluster_new_job_existing_notebooks_job
399
}
4010

41-
output "existing_cluster_new_job_existing_notebooks_id" {
42-
description = "databricks new cluster job id"
11+
output "job_id" {
12+
description = "job id"
4313
value = module.databricks_workspace_management.existing_cluster_new_job_existing_notebooks_id
4414
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
provider "databricks" {
2+
host = var.workspace_url
3+
token = var.dapi_token
4+
}
5+
6+
terraform {
7+
required_providers {
8+
databricks = {
9+
source = "databrickslabs/databricks"
10+
version = "~> 0.5.7"
11+
}
12+
}
13+
}
14+
15+
16+
module "databricks_workspace_management" {
17+
source = "../../../"
18+
# ------------------------------------------------
19+
# JOB
20+
# ------------------------------------------------
21+
deploy_jobs = true
22+
cluster_id = "0606-193951-30y13dr5"
23+
fixed_value = 1
24+
retry_on_timeout = false
25+
max_retries = 3
26+
timeout = 30
27+
min_retry_interval_millis = 10
28+
max_concurrent_runs = 1
29+
task_parameters = {
30+
"hello" = "world",
31+
"ping" = "pong"
32+
}
33+
schedule = {
34+
cron_expression = "1 0 7 * * ?",
35+
timezone_id = "America/Los_Angeles",
36+
pause_status = "UNPAUSED"
37+
}
38+
email_notifications = {
39+
on_failure = ["[email protected]"],
40+
no_alert_for_skipped_runs = true,
41+
on_start = ["[email protected]"],
42+
on_success = ["[email protected]"]
43+
}
44+
# ------------------------------------------------
45+
# NOTEBOOK
46+
# ------------------------------------------------
47+
local_notebooks = [
48+
{
49+
job_name = "local_demo_job1"
50+
language = "PYTHON"
51+
local_path = "notebooks/sample1.py"
52+
path = "/Shared/demo/sample1.py"
53+
},
54+
{
55+
job_name = "local_demo_job2"
56+
local_path = "notebooks/sample2.py"
57+
}
58+
]
59+
# ------------------------------------------------
60+
# Do not change the teamid, prjid once set.
61+
teamid = var.teamid
62+
prjid = var.prjid
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
output "notebook_url" {
2+
description = "databricks notebook url"
3+
value = module.databricks_workspace_management.notebook_url
4+
}
5+
6+
output "job_url" {
7+
description = "databricks job url"
8+
value = module.databricks_workspace_management.existing_cluster_new_job_new_notebooks_job
9+
}
10+
11+
output "job_id" {
12+
description = "databricks job id"
13+
value = module.databricks_workspace_management.existing_cluster_new_job_new_notebooks_id
14+
}
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
variable "teamid" {
2+
description = "Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply'"
3+
type = string
4+
}
5+
6+
variable "prjid" {
7+
description = "Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'"
8+
type = string
9+
}
10+
11+
variable "workspace_url" {
12+
description = "databricks workspace url"
13+
type = string
14+
}
15+
16+
variable "dapi_token" {
17+
description = "databricks dapi token"
18+
type = string
19+
}

examples/notebooks/1_deploy_notebooks/main.tf

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ terraform {
1515

1616
module "databricks_workspace_management" {
1717
source = "../../../"
18-
19-
workspace_url = var.workspace_url
20-
dapi_token = var.dapi_token
2118
# ------------------------------------------------
2219
# NOTEBOOK
2320
# ------------------------------------------------

0 commit comments

Comments
 (0)