Skip to content

Commit 015f030

Browse files
authored
Refactor Key Vault role assignment and add UAMI
Updated Key Vault role assignment to use user assigned identity and added a user assigned managed identity resource for the backend container app.
1 parent c19eaae commit 015f030

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

infra/terraform/_aca-mcp.tf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@
22
resource "azurerm_role_assignment" "kv_secrets_camcp" {
33
scope = azurerm_key_vault.main.id
44
role_definition_name = "Key Vault Secrets User"
5-
principal_id = azurerm_container_app.mcp.identity[0].principal_id
5+
principal_id = azurerm_user_assigned_identity.mcp.principal_id
6+
}
7+
8+
# User Assigned Managed Identity for Backend Container App
9+
resource "azurerm_user_assigned_identity" "mcp" {
10+
name = "uami-mcp-${var.iteration}"
11+
resource_group_name = azurerm_resource_group.rg.name
12+
location = azurerm_resource_group.rg.location
613
}
714

815
resource "azurerm_container_app" "mcp" {
916
name = "ca-mcp-${var.iteration}"
1017
container_app_environment_id = azurerm_container_app_environment.cae.id
1118
resource_group_name = azurerm_resource_group.rg.name
1219
revision_mode = "Single"
13-
20+
1421
identity {
15-
type = "SystemAssigned"
22+
type = "UserAssigned"
23+
identity_ids = [azurerm_user_assigned_identity.mcp.id]
1624
}
1725

18-
1926
ingress {
2027
target_port = 8000
2128
external_enabled = true

0 commit comments

Comments
 (0)