Closed ashkuren closed 1 year ago
2.7.0
1.3.7
3.37.0
Policy Assignment has a Managed Identity and Permissions assigned.
Policy Assignment has a Managed Identity that does not have any permissions.
https://github.com/gettek/terraform-azurerm-policy-as-code/blob/9e050095c54393a3b90e6b60a6b3916bec5734c6/modules/def_assignment/variables.tf#L165 local.identity_type == { type = "SystemAssigned" } is always evaluates to false and therefore local.role_definition_ids is always an empty list.
local.identity_type == { type = "SystemAssigned" }
false
local.role_definition_ids
Possibly related: https://github.com/hashicorp/terraform/issues/27643
role_definition_ids = var.skip_role_assignment == false && local.identity_type.type == "SystemAssigned" ? try(coalescelist(var.role_definition_ids, lookup(jsondecode(var.definition.policy_rule).then.details, "roleDefinitionIds", [])), []) : []
Create any policy assignment with definition that contains roleDefinitionIds.
roleDefinitionIds
Thank you for raising, overlooked this in my tests...
Should be fixed in working branch 2.7.1, could you kindly retry and report back. Thanks
Works as expected now. Thank you for quick fix.
Role Definitions are not assigned to System Managed Identities
Prerequisites
Context
2.7.0
1.3.7
3.37.0
Expected Behavior
Policy Assignment has a Managed Identity and Permissions assigned.
Current Behavior
Policy Assignment has a Managed Identity that does not have any permissions.
Possible Root Cause
https://github.com/gettek/terraform-azurerm-policy-as-code/blob/9e050095c54393a3b90e6b60a6b3916bec5734c6/modules/def_assignment/variables.tf#L165
local.identity_type == { type = "SystemAssigned" }
is always evaluates tofalse
and thereforelocal.role_definition_ids
is always an empty list.Possibly related: https://github.com/hashicorp/terraform/issues/27643
Possible Solution
Steps to Reproduce
Create any policy assignment with definition that contains
roleDefinitionIds
.