Skip to content

Commit

Permalink
Fix unit tests failing
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentLesle committed Dec 8, 2023
1 parent 55c3162 commit af0e72a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources.policy_assignments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "azurerm_management_group_policy_assignment" "enterprise_scale" {
)
content {
type = identity.value.type
identity_ids = try(keys(identity.value.userAssignedIdentities), null)
identity_ids = can(identity.value.userAssignedIdentities) ? identity.value.userAssignedIdentities : null
}
}

Expand Down
2 changes: 1 addition & 1 deletion resources.role_assignments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module "role_assignments_for_policy" {
data "azapi_resource" "user_msi" {
for_each = {
for ik, iv in local.es_role_assignments_by_policy_assignment : ik => iv
if one(azurerm_management_group_policy_assignment.enterprise_scale[ik].identity[0].identity_ids) != null
if try(azurerm_management_group_policy_assignment.enterprise_scale[ik].identity[0].type, null) == "UserAssigned"
}

resource_id = one(azurerm_management_group_policy_assignment.enterprise_scale[each.key].identity[0].identity_ids)
Expand Down

0 comments on commit af0e72a

Please sign in to comment.