Skip to content

Commit 7336b73

Browse files
Leonid_Frolov1Leonid_Frolov1
authored andcommitted
feat: added bool flag
1 parent ac8d4a9 commit 7336b73

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ locals {
44
}
55

66
data "azurerm_key_vault_secret" "sp_client_id" {
7-
count = var.mountpoints == {} ? 0 : 1
7+
count = var.mount_enabled ? 1 : 0
88

99
name = var.sp_client_id_secret_name
1010
key_vault_id = var.key_vault_id
1111
}
1212

1313
data "azurerm_key_vault_secret" "sp_key" {
14-
count = var.mountpoints == {} ? 0 : 1
14+
count = var.mount_enabled ? 1 : 0
1515

1616
name = var.sp_key_secret_name
1717
key_vault_id = var.key_vault_id

mount.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "databricks_mount" "adls" {
2-
for_each = var.mountpoints
2+
for_each = var.mount_enabled ? var.mountpoints : {}
33

44
name = each.key
55
cluster_id = var.mount_cluster_name != null ? databricks_cluster.cluster[var.mount_cluster_name].id : null

secrets.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
locals {
2-
sp_secrets = var.mountpoints == {} ? {} : {
2+
sp_secrets = var.mount_enabled ? {
33
(var.sp_client_id_secret_name) = { value = data.azurerm_key_vault_secret.sp_client_id[0].value }
44
(var.sp_key_secret_name) = { value = data.azurerm_key_vault_secret.sp_key[0].value }
5-
}
5+
} : {}
66

77
secrets_objects_list = flatten([for param in var.secret_scope : [
88
for secret in param.secrets : {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,9 @@ variable "mount_cluster_name" {
209209
description = "Name of the cluster that will be used during storage mounting. If mount_adls_passthrough == true, cluster should also have option cluster_conf_passthrought == true"
210210
default = null
211211
}
212+
213+
variable "mount_enabled" {
214+
type = bool
215+
description = "Boolean flag to enable ADLS mount to Databricks"
216+
default = true
217+
}

0 commit comments

Comments
 (0)