Skip to content

Commit d526d14

Browse files
authored
Merge pull request #69 from tomarv2/develop
Pulling refs/pull/68/merge into main
2 parents 81db3ee + c2d7ce4 commit d526d14

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ No modules.
337337
| [databricks_job.existing_cluster_new_job_new_notebooks](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/job) | resource |
338338
| [databricks_job.new_cluster_new_job_existing_notebooks](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/job) | resource |
339339
| [databricks_job.new_cluster_new_job_new_notebooks](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/job) | resource |
340+
| [databricks_library.maven](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/library) | resource |
341+
| [databricks_library.python_wheel](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/library) | resource |
340342
| [databricks_notebook.notebook_file](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/notebook) | resource |
341343
| [databricks_notebook.notebook_file_deployment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/notebook) | resource |
342344
| [databricks_permissions.cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/permissions) | resource |
@@ -391,6 +393,7 @@ No modules.
391393
| <a name="input_idle_instance_autotermination_minutes"></a> [idle\_instance\_autotermination\_minutes](#input\_idle\_instance\_autotermination\_minutes) | idle instance auto termination duration | `number` | `20` | no |
392394
| <a name="input_instance_pool_access_control"></a> [instance\_pool\_access\_control](#input\_instance\_pool\_access\_control) | Instance pool access control | `any` | `null` | no |
393395
| <a name="input_jobs_access_control"></a> [jobs\_access\_control](#input\_jobs\_access\_control) | Jobs access control | `any` | `null` | no |
396+
| <a name="input_libraries"></a> [libraries](#input\_libraries) | Installs a library on databricks\_cluster | `map(any)` | `{}` | no |
394397
| <a name="input_local_disk"></a> [local\_disk](#input\_local\_disk) | Pick only nodes with local storage. Defaults to false. | `string` | `true` | no |
395398
| <a name="input_local_notebooks"></a> [local\_notebooks](#input\_local\_notebooks) | Local path to the notebook(s) that will be used by the job | `any` | `[]` | no |
396399
| <a name="input_max_capacity"></a> [max\_capacity](#input\_max\_capacity) | instance pool maximum capacity | `number` | `3` | no |

cluster.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ locals {
33
cluster_name = var.cluster_name != null ? var.cluster_name : "${var.teamid}-${var.prjid} (Terraform managed)"
44
}
55

6+
resource "databricks_library" "maven" {
7+
for_each = try(var.libraries.maven, null) != null ? var.libraries.maven : {}
8+
9+
cluster_id = databricks_cluster.cluster[local.cluster_name].id
10+
maven {
11+
coordinates = each.key
12+
exclusions = try(each.value.exclusion, [])
13+
}
14+
}
15+
16+
resource "databricks_library" "python_wheel" {
17+
for_each = try(var.libraries.python_wheel, null) != null ? var.libraries.python_wheel: {}
18+
19+
cluster_id = databricks_cluster.cluster[local.cluster_name].id
20+
whl = each.key
21+
}
22+
623
resource "databricks_cluster" "cluster" {
724
for_each = var.deploy_cluster == true ? toset([local.cluster_name]) : toset([])
825

examples/clusters/1_single_node_cluster/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ module "databricks_workspace_management" {
1919
# ------------------------------------------------
2020
deploy_cluster = true
2121
fixed_value = 0
22+
23+
libraries = {
24+
maven = {
25+
"com.microsoft.azure:azure-eventhubs-spark_2.12:2.3.21" = {}
26+
}
27+
python_wheel = {}
28+
}
29+
2230
# ------------------------------------------------
2331
# Do not change the teamid, prjid once set.
2432
teamid = var.teamid

examples/jobs/4_job_on_existing_cluster_with_new_notebooks/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ terraform {
1515

1616
module "databricks_workspace_management" {
1717
source = "../../../"
18+
1819
# ------------------------------------------------
1920
# JOB
2021
# ------------------------------------------------
2122
deploy_jobs = true
22-
cluster_id = "0606-193951-30y13dr5"
23+
cluster_id = "0907-052446-bike152"
2324
fixed_value = 1
2425
retry_on_timeout = false
2526
max_retries = 3

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,9 @@ variable "custom_tags" {
358358
description = "Extra custom tags"
359359
default = null
360360
}
361+
362+
variable "libraries" {
363+
type = map(any)
364+
description = "Installs a library on databricks_cluster"
365+
default = {}
366+
}

0 commit comments

Comments
 (0)