diff --git a/main.tf b/main.tf index c92c7b5..5aaf32f 100644 --- a/main.tf +++ b/main.tf @@ -36,6 +36,15 @@ resource "azurerm_role_assignment" "this" { principal_id = data.azurerm_client_config.current.object_id } +resource "azurerm_role_assignment" "additional" { + for_each = var.key_vault_role_assignments + + scope = azurerm_key_vault.this.id + role_definition_name = each.value.role_definition_name + principal_id = each.value.principal_id + description = each.value.description +} + resource "azurerm_key_vault_key" "cmkrsa" { count = var.key_vault.cmk_keys_create ? 1 : 0 diff --git a/variables.tf b/variables.tf index 01a173e..ad55ca7 100644 --- a/variables.tf +++ b/variables.tf @@ -125,3 +125,24 @@ variable "tags" { description = "A mapping of tags to assign to the resources." type = map(string) } + +variable "role_assignments" { + type = map(object({ + role_definition_name = string + principal_id = string + description = optional(string, null) + condition = optional(string, null) + condition_version = optional(string, null) + })) + default = {} + description = <