Skip to content

Commit 4cfee37

Browse files
Leonid_Frolov1Leonid_Frolov1
authored andcommitted
feat: added credential passthrough
1 parent def125d commit 4cfee37

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

cluster.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ resource "databricks_cluster" "cluster" {
33

44
cluster_name = each.value.cluster_name
55
spark_version = each.value.spark_version
6-
spark_conf = each.value.spark_conf
6+
spark_conf = each.value.enabled_adls_passthrought ? merge(each.value.spark_conf,
7+
{
8+
"spark.databricks.cluster.profile" : "serverless",
9+
"spark.databricks.repl.allowedLanguages" : "python,sql",
10+
"spark.databricks.passthrough.enabled" : "true",
11+
"spark.databricks.pyspark.enableProcessIsolation" : "true"
12+
}) : each.value.spark_conf
713
spark_env_vars = each.value.spark_env_vars
814
data_security_mode = each.value.data_security_mode
915
node_type_id = each.value.node_type_id

mount.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ resource "databricks_mount" "adls" {
33

44
name = each.key
55
uri = "abfss://${each.value["container_name"]}@${each.value["storage_account_name"]}.dfs.core.windows.net"
6-
extra_configs = {
6+
extra_configs = var.mount_adls_passthrough ? {
7+
"fs.azure.account.auth.type" : "CustomAccessToken",
8+
"fs.azure.account.custom.token.provider.class" : "{{sparkconf/spark.databricks.passthrough.adls.gen2.tokenProviderClassName}}"
9+
} : {
710
"fs.azure.account.auth.type" : "OAuth",
811
"fs.azure.account.oauth.provider.type" : "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
912
"fs.azure.account.oauth2.client.id" : data.azurerm_key_vault_secret.sp_client_id.value,

outputs.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ output "metastore_id" {
1616
output "token" {
1717
value = databricks_token.pat.token_value
1818
description = "Databricks Personal Authorization Token"
19+
sensitive = true
1920
}

variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ variable "clusters" {
228228
cluster_name = string
229229
spark_version = optional(string, "11.3.x-scala2.12")
230230
spark_conf = optional(map(any), {})
231+
enabled_adls_passthrought = optional(bool, false)
231232
spark_env_vars = optional(map(any), {})
232233
data_security_mode = optional(string, "USER_ISOLATION")
233234
node_type_id = optional(string, "Standard_D3_v2")
@@ -252,3 +253,9 @@ variable "pat_token_lifetime_seconds" {
252253
description = "The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely"
253254
default = 315569520
254255
}
256+
257+
variable "mount_adls_passthrough" {
258+
type = bool
259+
description = "Boolean flag for Unity Catalog Metastore current in this environment. One Metastore per region"
260+
default = false
261+
}

0 commit comments

Comments
 (0)