Skip to content

Commit f9467cb

Browse files
authored
Merge pull request #68 from tomarv2/add_lib
Add lib
2 parents f93faae + 7f3f71b commit f9467cb

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

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)