Installs a library on databricks_cluster. Each different type of library has a slightly different syntax. It's possible to set only one type of library within one resource. Otherwise, the plan will fail with an error.
You can install libraries on all clusters with the help of databricks_clusters data resource:
data "databricks_clusters" "all" {
}
resource "databricks_library" "cli" {
for_each = data.databricks_clusters.all.ids
cluster_id = each.key
pypi {
package = "databricks-cli"
}
}
resource "databricks_dbfs_file" "app" {
source = "${path.module}/app-0.0.1.jar"
path = "/FileStore/app-0.0.1.jar"
}
resource "databricks_library" "app" {
cluster_id = databricks_cluster.this.id
jar = databricks_dbfs_file.app.dbfs_path
}
Installing artifacts from Maven repository. You can also optionally specify a repo
parameter for a custom Maven-style repository, that should be accessible without any authentication. Maven libraries are resolved in Databricks Control Plane, so repo should be accessible from it. It can even be properly configured maven s3 wagon, AWS CodeArtifact or Azure Artifacts.
resource "databricks_library" "deequ" {
cluster_id = databricks_cluster.this.id
maven {
coordinates = "com.amazon.deequ:deequ:1.0.4"
// exclusions block is optional
exclusions = ["org.apache.avro:avro"]
}
}
resource "databricks_dbfs_file" "app" {
source = "${path.module}/baz.whl"
path = "/FileStore/baz.whl"
}
resource "databricks_library" "app" {
cluster_id = databricks_cluster.this.id
whl = databricks_dbfs_file.app.dbfs_path
}
Installing Python PyPI artifacts. You can optionally also specify the repo
parameter for a custom PyPI mirror, which should be accessible without any authentication for the network that cluster runs in.
resource "databricks_library" "fbprophet" {
cluster_id = databricks_cluster.this.id
pypi {
package = "fbprophet==0.6"
// repo can also be specified here
}
}
resource "databricks_dbfs_file" "app" {
source = "${path.module}/foo.egg"
path = "/FileStore/foo.egg"
}
resource "databricks_library" "app" {
cluster_id = databricks_cluster.this.id
egg = databricks_dbfs_file.app.dbfs_path
}
Installing artifacts from CRan. You can also optionally specify a repo
parameter for a custom cran mirror.
resource "databricks_library" "rkeops" {
cluster_id = databricks_cluster.this.id
cran {
package = "rkeops"
}
}
The following resources are often used in the same context:
dbfs:/mnt/name
.