diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 4b2399d..e318778 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -26,7 +26,7 @@ module "alz_rbac" { custom_groups = { "AMG_ALZ_OWNER" = { - pim_enabled = true + azuread_role_assignable = true role_assignments = { "Owner" = ["mg:alz"] } diff --git a/main.tf b/main.tf index e453546..7f33c17 100644 --- a/main.tf +++ b/main.tf @@ -5,7 +5,7 @@ resource "azuread_group" "custom_groups" { display_name = each.key description = "Automatically generated by terraform" security_enabled = true - assignable_to_role = tobool(each.value.pim_enabled) + assignable_to_role = tobool(each.value.azuread_role_assignable) } resource "azurerm_role_assignment" "custom_groups" { @@ -21,7 +21,7 @@ resource "azuread_group" "subscription_owners" { display_name = "SUB_${each.key}_OWNER" description = "Automatically generated by terraform. Grants Owner permissions on ${each.key} subscription." security_enabled = true - assignable_to_role = true + assignable_to_role = false } resource "azurerm_role_assignment" "subscription_owners" { for_each = var.subscriptions @@ -35,7 +35,7 @@ resource "azuread_group" "subscription_contributors" { display_name = "SUB_${each.key}_CONTRIBUTOR" description = "Automatically generated by terraform. Grants Contributor permissions on ${each.key} subscription." security_enabled = true - assignable_to_role = true + assignable_to_role = false } resource "azurerm_role_assignment" "subscription_contributors" { for_each = var.subscriptions @@ -63,7 +63,7 @@ resource "azuread_group" "management_owners" { display_name = "AMG_${each.key}_OWNER" description = "Automatically generated by terraform. Grants Owner permissions on ${each.value.display_name} management group." security_enabled = true - assignable_to_role = true + assignable_to_role = false } resource "azurerm_role_assignment" "management_owners" { for_each = var.management_groups @@ -77,7 +77,7 @@ resource "azuread_group" "management_contributors" { display_name = "AMG_${each.key}_CONTRIBUTOR" description = "Automatically generated by terraform. Grants Contributor permissions on ${each.value.display_name} management group." security_enabled = true - assignable_to_role = true + assignable_to_role = false } resource "azurerm_role_assignment" "management_contributors" { for_each = var.management_groups diff --git a/variables.tf b/variables.tf index 00a3b89..8059784 100644 --- a/variables.tf +++ b/variables.tf @@ -20,13 +20,13 @@ variable "management_groups" { variable "custom_groups" { type = map(object({ - pim_enabled = optional(bool) + azuread_role_assignable = optional(bool) role_assignments = map(list(string)) })) description = <<-DOC ``` "" = { - pim_enabled = optional(string) (if you want the role assignment to be pimmable) + azuread_role_assignable = optional(string) (if you want to assign Azure AD roles to the group) role_assignments = { "" = [ (must be a role_definition_name or role_definition_id from azure) "" (every element must be a scope: "mg:", "sub:", "root" for Tenant Root Group or a full scope ID)