Skip to content

Commit 2103eea

Browse files
Update main.tf
1 parent 986f72f commit 2103eea

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

main.tf

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,6 @@ resource "azurerm_key_vault" "kv1" {
275275
storage_permissions = ["Get"]
276276
}
277277

278-
access_policy {
279-
# Access policy for CosmosDB
280-
tenant_id = data.azurerm_client_config.current.tenant_id
281-
object_id = azurerm_cosmosdb_account.cs_cosmosdb.identity[0].principal_id
282-
key_permissions = ["Get", "Create", "List", "Delete", "GetRotationPolicy", "SetRotationPolicy"]
283-
284-
secret_permissions = [
285-
"Get", "Backup", "Delete", "List", "Purge", "Recover", "Restore", "Set",
286-
]
287-
storage_permissions = ["Get"]
288-
}
289-
290278
tags = {
291279
Owner = var.owner_tag
292280
Environment = var.environment_tag
@@ -315,6 +303,15 @@ resource "azurerm_key_vault_access_policy" "kv1_vmsb_access" {
315303
secret_permissions = ["Get", "List"]
316304
}
317305

306+
resource "azurerm_key_vault_access_policy" "cosmosdb" {
307+
key_vault_id = azurerm_key_vault.kv1.id
308+
309+
tenant_id = data.azurerm_client_config.current.tenant_id
310+
object_id = azurerm_cosmosdb_account.cs_cosmosdb.identity[0].principal_id
311+
312+
key_permissions = ["Get", "WrapKey", "UnwrapKey"]
313+
}
314+
318315
/*******************************************************************************
319316
CREATE KEY VAULT SECRETS
320317
*******************************************************************************/

0 commit comments

Comments
 (0)