File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -46,10 +46,27 @@ resource "databricks_secret" "this" {
4646
4747# Azure Key Vault-backed Scope
4848resource "azurerm_key_vault_access_policy" "databricks" {
49- for_each = {
49+ for_each = var . create_databricks_access_policy_to_key_vault ? {
5050 for param in var . key_vault_secret_scope : (param. name ) => param
5151 if length (param. name ) != 0
52- }
52+ } : {}
53+
54+ key_vault_id = each. value . key_vault_id
55+ object_id = " 9b38785a-6e08-4087-a0c4-20634343f21f" # Global 'AzureDatabricks' SP object id
56+ tenant_id = data. azurerm_key_vault_secret . tenant_id . value
57+
58+ secret_permissions = [
59+ " Get" ,
60+ " List" ,
61+ ]
62+ }
63+
64+ # Azure Key Vault-backed Scope
65+ resource "azurerm_key_vault_access_policy" "databricks" {
66+ for_each = var. create_databricks_access_policy_to_key_vault ? {
67+ for param in var . key_vault_secret_scope : (param. name ) => param
68+ if length (param. name ) != 0
69+ } : {}
5370
5471 key_vault_id = each. value . key_vault_id
5572 object_id = " 9b38785a-6e08-4087-a0c4-20634343f21f" # Global 'AzureDatabricks' SP object id
Original file line number Diff line number Diff line change @@ -118,6 +118,12 @@ variable "key_vault_id" {
118118}
119119
120120# Azure Key Vault-backed Secret Scope
121+ variable "create_databricks_access_policy_to_key_vault" {
122+ type = bool
123+ description = " Boolean flag to enable creation of Key Vault Access Policy for Databricks Global Service Principal."
124+ default = true
125+ }
126+
121127variable "key_vault_secret_scope" {
122128 type = list (object ({
123129 name = optional (string )
You can’t perform that action at this time.
0 commit comments