Skip to content

Commit 504d939

Browse files
authored
Merge pull request #33 from data-platform-hq/feat_secret_scope_kv_policy_condition
fix: added condition for key vault access policy creation
2 parents 1cbc754 + 03d35c9 commit 504d939

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

secrets.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ resource "databricks_secret" "this" {
4646

4747
# Azure Key Vault-backed Scope
4848
resource "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+
} : {}
5353

5454
key_vault_id = each.value.key_vault_id
5555
object_id = "9b38785a-6e08-4087-a0c4-20634343f21f" # Global 'AzureDatabricks' SP object id

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
121127
variable "key_vault_secret_scope" {
122128
type = list(object({
123129
name = optional(string)

0 commit comments

Comments
 (0)