Skip to content

Commit

Permalink
onboard all the mgmt group when empty list of ids (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
matteopasa authored Feb 2, 2024
1 parent 3ffe0a7 commit 383d139
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/services/event-hub-data-source/organizational.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ data "azurerm_management_group" "onboarded_management_group" {
name = each.value
}

data "azurerm_management_group" "root_management_group" {
count = var.is_organizational && length(var.management_group_ids) == 0 ? 1 : 0
display_name = "Tenant Root Group"
}

locals {
selected_management_group = length(data.azurerm_management_group.onboarded_management_group) > 0 ? values(data.azurerm_management_group.onboarded_management_group) : [data.azurerm_management_group.root_management_group[0]]
all_mg_subscription_ids = flatten([
for mg in data.azurerm_management_group.onboarded_management_group : mg.all_subscription_ids
for mg in local.selected_management_group : mg.all_subscription_ids
])
}

Expand Down

0 comments on commit 383d139

Please sign in to comment.