Skip to content

Commit cda270c

Browse files
feat: added App Key Vault RBAC role assignments
1 parent d42f33c commit cda270c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

infrastructure/modules/infra/main.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
locals {
2+
key_vault_secrets_officers = [
3+
"mi-lungcs-poc-ghtoaz-uks",
4+
"Azure-Lung-Cancer-Screening---Dev-Owner"
5+
]
6+
}
7+
18
resource "azurerm_resource_group" "main" {
29
name = var.resource_group_name
310
location = var.region
@@ -24,6 +31,22 @@ module "app-key-vault" {
2431
purge_protection_enabled = var.protect_keyvault
2532
}
2633

34+
data "azuread_service_principal" "identity" {
35+
for_each = local.key_vault_secrets_officers
36+
37+
display_name = each.value
38+
}
39+
40+
module "key_vault_rbac_assignments" {
41+
for_each = data.azuread_service_principal.identity
42+
43+
source = "../dtos-devops-templates/infrastructure/modules/rbac-assignment"
44+
45+
principal_id = each.value.object_id
46+
role_definition_name = "Key Vault Secrets Officer"
47+
scope = module.app-key-vault.key_vault_id
48+
}
49+
2750
module "log_analytics_workspace_audit" {
2851
source = "../dtos-devops-templates/infrastructure/modules/log-analytics-workspace"
2952

infrastructure/modules/infra/providers.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@ terraform {
44
source = "hashicorp/azurerm"
55
configuration_aliases = [azurerm.hub]
66
}
7+
8+
azuread = {
9+
source = "hashicorp/azuread"
10+
version = "3.6.0"
11+
}
712
}
813
}

0 commit comments

Comments
 (0)