Hi @KunalGaurav,
This can be done by using a dynamic configuration block inside your databricks_cluster resource definition.
- In variable.tf make a library block as:-
variable "listOfMavenPackages" {
type = list(string)
default = [ "com.google.guava:guava:23.0" , "com.google.protobuf:protobuf-java-util:3.17.3" ]
}
- In main.tf, within databricks_cluster you may write as:-
resource "databricks_cluster" "shared_autoscaling" {
cluster_name = "Shared Autoscaling"
spark_version = data.databricks_spark_version.latest_lts.id
node_type_id = data.databricks_node_type.smallest.id
autotermination_minutes = 20
autoscale {
min_workers = 1
max_workers = 2
}
dynamic "library" {
for_each = toset(var.listOfMavenPackages)
content {
maven {
coordinates = library.value
}
}
}
}
I hope this helps you.
Best Regards,
Simran