Skip to content

Commit 0be67e6

Browse files
committed
Add defaults on jobs that terraform applies
1 parent 4a693c0 commit 0be67e6

File tree

19 files changed

+54
-0
lines changed

19 files changed

+54
-0
lines changed

acceptance/bundle/includes/yml_outside_root/output.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Validation OK!
1616
},
1717
"edit_mode": "UI_LOCKED",
1818
"format": "MULTI_TASK",
19+
"max_concurrent_runs": 1,
1920
"name": "include_outside_root",
2021
"permissions": [],
2122
"queue": {

acceptance/bundle/override/job_cluster/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
}
1919
}
2020
],
21+
"max_concurrent_runs": 1,
2122
"name": "job",
2223
"permissions": [],
2324
"queue": {
@@ -45,6 +46,7 @@
4546
}
4647
}
4748
],
49+
"max_concurrent_runs": 1,
4850
"name": "job",
4951
"permissions": [],
5052
"queue": {

acceptance/bundle/override/job_cluster_var/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
}
1919
}
2020
],
21+
"max_concurrent_runs": 1,
2122
"name": "job",
2223
"permissions": [],
2324
"queue": {
@@ -54,6 +55,7 @@ Validation OK!
5455
}
5556
}
5657
],
58+
"max_concurrent_runs": 1,
5759
"name": "job",
5860
"permissions": [],
5961
"queue": {

acceptance/bundle/override/job_tasks/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"max_concurrent_runs": 1,
23
"name": "job",
34
"permissions": [],
45
"queue": {
@@ -34,6 +35,7 @@ Error: file test1.py not found
3435

3536
Exit code: 1
3637
{
38+
"max_concurrent_runs": 1,
3739
"name": "job",
3840
"permissions": [],
3941
"queue": {

acceptance/bundle/paths/git_source_jobs/output.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"git_provider": "gitHub",
1414
"git_url": "https://github.com/foo"
1515
},
16+
"max_concurrent_runs": 1,
1617
"name": "my_job",
1718
"permissions": [],
1819
"queue": {

acceptance/bundle/paths/relative_path_outside_root/output.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"edit_mode": "UI_LOCKED",
1212
"format": "MULTI_TASK",
13+
"max_concurrent_runs": 1,
1314
"name": "include_outside_root",
1415
"permissions": [],
1516
"queue": {

acceptance/bundle/python/mutator-ordering/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
},
1919
"edit_mode": "UI_LOCKED",
2020
"format": "MULTI_TASK",
21+
"max_concurrent_runs": 1,
22+
"name": "Untitled",
2123
"permissions": [],
2224
"queue": {
2325
"enabled": true

acceptance/bundle/python/resolve-variable/output.txt

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"edit_mode": "UI_LOCKED",
1919
"format": "MULTI_TASK",
20+
"max_concurrent_runs": 1,
2021
"name": "abc",
2122
"permissions": [],
2223
"queue": {

acceptance/bundle/python/resource-loading/output.txt

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"edit_mode": "UI_LOCKED",
2020
"format": "MULTI_TASK",
21+
"max_concurrent_runs": 1,
2122
"name": "Job 1",
2223
"permissions": [],
2324
"queue": {
@@ -31,6 +32,7 @@
3132
},
3233
"edit_mode": "UI_LOCKED",
3334
"format": "MULTI_TASK",
35+
"max_concurrent_runs": 1,
3436
"name": "Job 2",
3537
"permissions": [],
3638
"queue": {
@@ -44,6 +46,7 @@
4446
},
4547
"edit_mode": "UI_LOCKED",
4648
"format": "MULTI_TASK",
49+
"max_concurrent_runs": 1,
4750
"name": "Job 3",
4851
"permissions": [],
4952
"queue": {

acceptance/bundle/validate/empty_resources/empty_dict/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
},
1010
"edit_mode": "UI_LOCKED",
1111
"format": "MULTI_TASK",
12+
"max_concurrent_runs": 1,
13+
"name": "Untitled",
1214
"permissions": [],
1315
"queue": {
1416
"enabled": true

acceptance/bundle/validate/empty_resources/with_grants/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Warning: unknown field: grants
1313
},
1414
"edit_mode": "UI_LOCKED",
1515
"format": "MULTI_TASK",
16+
"max_concurrent_runs": 1,
17+
"name": "Untitled",
1618
"permissions": [],
1719
"queue": {
1820
"enabled": true

acceptance/bundle/validate/empty_resources/with_permissions/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
},
1010
"edit_mode": "UI_LOCKED",
1111
"format": "MULTI_TASK",
12+
"max_concurrent_runs": 1,
13+
"name": "Untitled",
1214
"permissions": [],
1315
"queue": {
1416
"enabled": true

acceptance/bundle/validate/presets_name_prefix/output.txt

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"edit_mode": "UI_LOCKED",
1414
"format": "MULTI_TASK",
15+
"max_concurrent_runs": 1,
1516
"name": "prefix-job1",
1617
"permissions": [],
1718
"queue": {
@@ -47,6 +48,7 @@
4748
},
4849
"edit_mode": "UI_LOCKED",
4950
"format": "MULTI_TASK",
51+
"max_concurrent_runs": 1,
5052
"name": "[prefix]job1",
5153
"permissions": [],
5254
"queue": {
@@ -82,6 +84,7 @@
8284
},
8385
"edit_mode": "UI_LOCKED",
8486
"format": "MULTI_TASK",
87+
"max_concurrent_runs": 1,
8588
"name": "job1",
8689
"permissions": [],
8790
"queue": {

acceptance/bundle/variables/complex/out.default.json

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
}
2525
}
2626
],
27+
"max_concurrent_runs": 1,
28+
"name": "Untitled",
2729
"permissions": [],
2830
"queue": {
2931
"enabled": true

acceptance/bundle/variables/complex/out.dev.json

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
}
2323
}
2424
],
25+
"max_concurrent_runs": 1,
26+
"name": "Untitled",
2527
"permissions": [],
2628
"queue": {
2729
"enabled": true

acceptance/bundle/variables/complex_multiple_files/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
}
5959
}
6060
],
61+
"max_concurrent_runs": 1,
62+
"name": "Untitled",
6163
"permissions": [],
6264
"queue": {
6365
"enabled": true

acceptance/bundle/variables/prepend-workspace-var/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
},
2020
"edit_mode": "UI_LOCKED",
2121
"format": "MULTI_TASK",
22+
"max_concurrent_runs": 1,
23+
"name": "Untitled",
2224
"permissions": [],
2325
"queue": {
2426
"enabled": true

acceptance/bundle/variables/resolve-nonstrings/output.txt

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
},
2525
"edit_mode": "UI_LOCKED",
2626
"format": "MULTI_TASK",
27+
"max_concurrent_runs": 1,
28+
"name": "Untitled",
2729
"notification_settings": {
2830
"no_alert_for_canceled_runs": true,
2931
"no_alert_for_skipped_runs": false

bundle/config/mutator/resourcemutator/resource_mutator.go

+20
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ func applyInitializeMutators(ctx context.Context, b *bundle.Bundle) diag.Diagnos
5151
{"resources.dashboards.*.parent_path", b.Config.Workspace.ResourcePath},
5252
{"resources.dashboards.*.embed_credentials", false},
5353
{"resources.volumes.*.volume_type", "MANAGED"},
54+
55+
// Jobs:
56+
57+
// The defaults are the same as for terraform provider latest version (v1.75.0)
58+
// https://github.com/databricks/terraform-provider-databricks/blob/v1.75.0/jobs/resource_job.go#L532
59+
{"resources.jobs.*.name", "Untitled"},
60+
{"resources.jobs.*.max_concurrent_runs", 1},
61+
{"resources.jobs.*.schedule.pause_status", "UNPAUSED"},
62+
{"resources.jobs.*.trigger.pause_status", "UNPAUSED"},
63+
{"resources.jobs.*.continuous.pause_status", "UNPAUSED"},
64+
65+
// This is converted from single-task to multi-task
66+
{"resources.jobs.*.task[*].dbt_task.schema", "default"},
67+
{"resources.jobs.*.task[*].for_each_task.task.dbt_task.schema", "default"},
68+
69+
// https://github.com/databricks/terraform-provider-databricks/blob/v1.75.0/clusters/resource_cluster.go
70+
// This triggers SingleNodeCluster() cluster validator. It needs to be run before applying defaults.
71+
//{"resources.jobs.*.job_clusters[*].new_cluster.num_workers", 0},
72+
{"resources.jobs.*.job_clusters[*].new_cluster.workload_type.clients.notebooks", true},
73+
{"resources.jobs.*.job_clusters[*].new_cluster.workload_type.clients.jobs", true},
5474
}
5575

5676
for _, defaultDef := range defaults {

0 commit comments

Comments
 (0)