gettek / terraform-azurerm-policy-as-code

Terraform modules that simplify the workflow of custom and built-in Azure Policies

Home Page:https://learn.microsoft.com/en-us/azure/governance/policy/concepts/policy-as-code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

assignment_location has no effect?

edem86 opened this issue · comments

commented

When using the def_assignment module, and setting assignment_location to say westeurope seams not to have any effect on the location of the system assigned managed identity. It always gets created in uksouth. Was looking at code but can't see a reason why it wouldn't let me override the default value ?

Thank you !

Hi @edem86

Can you provide a code snippet of the assignment please?

I have just tested by setting assignment_location = "westeurope" and seems to be working fine

This issue is stale because it has been open for 30 days with no activity.

@edem86 : Are you sure you are assigning a policy definition and not a policy set definition (= initiative)? The latter has a different default value for assignment_location located in modules/set_assignment/variables.tf where uk_south is used as default.

📓 The location field must also be specified when identity is specified.

Both assignment modules set uksouth as the default location value to circumvent errors. Since this is optional as specified in the docs, if it helps I can make it a conditional input in the next release such as below, keeping the default value if one is not explicitly specified:

locals {
   assignment_location = length(local.identity_type) > 0 ? var.assignment_location : null
}