Skip to content

Commit da5c698

Browse files
committed
Add container app policy to key vault operations
1 parent 9bf19de commit da5c698

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

terraform/main.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ resource "azurerm_container_app" "ca_app" {
3333
container_app_environment_id = azurerm_container_app_environment.ca_env.id
3434
revision_mode = "Single"
3535

36+
identity {
37+
type = "SystemAssigned"
38+
}
39+
3640
ingress {
3741
external_enabled = true
3842
target_port = var.container_port
@@ -90,3 +94,16 @@ resource "azurerm_container_app" "ca_app" {
9094
}
9195
}
9296
}
97+
98+
resource "azurerm_key_vault_access_policy" "ca_app_kv_policy" {
99+
key_vault_id = azurerm_key_vault.kv.id
100+
tenant_id = var.tenant_id
101+
object_id = azurerm_container_app.ca_app.identity[0].principal_id
102+
103+
secret_permissions = [
104+
"List",
105+
"Get"
106+
]
107+
108+
depends_on = [azurerm_container_app.ca_app]
109+
}

0 commit comments

Comments
 (0)