File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -59,20 +59,26 @@ resource "azurerm_key_vault_access_policy" "databricks" {
59
59
}
60
60
61
61
resource "databricks_secret_scope" "external" {
62
- count = var. key_vault_secret_scope . key_vault_id != null ? 1 : 0
62
+ for_each = {
63
+ for param in var . key_vault_secret_scope : (param. name ) => param
64
+ if param . name != null
65
+ }
63
66
64
- name = " external "
67
+ name = each . value . name
65
68
keyvault_metadata {
66
- resource_id = var . key_vault_secret_scope . key_vault_id
67
- dns_name = var . key_vault_secret_scope . dns_name
69
+ resource_id = each . value . key_vault_id
70
+ dns_name = each . value . dns_name
68
71
}
69
72
depends_on = [azurerm_key_vault_access_policy . databricks ]
70
73
}
71
74
72
75
resource "databricks_secret_acl" "external" {
73
- count = var. key_vault_secret_scope . key_vault_id != null ? 1 : 0
76
+ for_each = {
77
+ for param in var . key_vault_secret_scope : (param. name ) => param
78
+ if param . name != null
79
+ }
74
80
75
- scope = databricks_secret_scope. external [0 ]. name
81
+ scope = databricks_secret_scope. external [each . value . name ]. name
76
82
principal = " users"
77
83
permission = " READ"
78
84
}
Original file line number Diff line number Diff line change @@ -132,6 +132,17 @@ variable "key_vault_id" {
132
132
description = " ID of the Key Vault instance where the Secret resides"
133
133
}
134
134
135
+ # Azure Key Vault-backed Secret Scope
136
+ variable "key_vault_secret_scope" {
137
+ type = object ({
138
+ name = optional (string )
139
+ key_vault_id = optional (string )
140
+ dns_name = optional (string )
141
+ })
142
+ description = " Object with Azure Key Vault parameters required for creation of Azure-backed Databricks Secret scope"
143
+ default = {}
144
+ }
145
+
135
146
variable "tenant_id_secret_name" {
136
147
type = string
137
148
description = " The name of Azure Key Vault secret that contains tenant ID secret of Service Principal to access in Azure Key Vault"
@@ -215,14 +226,3 @@ variable "mount_cluster_name" {
215
226
default = null
216
227
}
217
228
218
- variable "key_vault_secret_scope" {
219
- type = object ({
220
- key_vault_id = string
221
- dns_name = string
222
- })
223
- description = " Object with Azure Key Vault parameters required for creation of Azure-backed Databricks Secret scope"
224
- default = {
225
- key_vault_id = null
226
- dns_name = null
227
- }
228
- }
You can’t perform that action at this time.
0 commit comments