You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using azapi_resource to set the default management group (see code below), subsequent plans and applies always find changes. This is because it pulls the Management Group name instead of the Management Group ID.
# Configuration of the default Management Group for all new Subscriptions.
resource "azapi_resource" "default_mg" {
type = "Microsoft.Management/managementGroups/settings@2023-04-01"
name = "default"
parent_id = data.azurerm_management_group.root_mg.id
body = {
properties = {
defaultManagementGroup = "${azurerm_management_group.sandbox.name}"
requireAuthorizationForGroupCreation = true
}
}
}
Terraform will perform the following actions:
# module.management_groups.azapi_resource.default_mg will be updated in-place
~ resource "azapi_resource" "default_mg" {
~ body = {
~ properties = {
~ defaultManagementGroup = "mg-sandbox" -> "/providers/Microsoft.Management/managementGroups/mg-sandbox"
# (1 unchanged attribute hidden)
}
}
id = "/providers/Microsoft.Management/managementGroups/xxx/settings/default"
name = "default"
~ output = {
- id = "/providers/Microsoft.Management/managementGroups/xxx/settings/default"
- properties = {
- tenantId = "xxx"
}
- type = "Microsoft.Management/managementGroups/settings"
} -> (known after apply)
# (5 unchanged attributes hidden)
}
I cannot set the default management group using the management group name of display name as it states I must use the ID. I can get around this issue with completing the initial deployment then on a subsequent deployment change the defaultManagementGroup value to the management group name.
The text was updated successfully, but these errors were encountered:
Let me know if I misunderstood the issue, the defaultManagementGroup requires the ID of the management group as it says in the doc. But the terraform plan finds the value in the remote state becomes the name of the management group.
I believe it's either an API issue or a document issue.
Please try:
Use management group name in the defaultManagementGroup to create the resource.
Add the lifecycle.ignore_changes to suppress the differences.
When using azapi_resource to set the default management group (see code below), subsequent plans and applies always find changes. This is because it pulls the Management Group name instead of the Management Group ID.
I cannot set the default management group using the management group name of display name as it states I must use the ID. I can get around this issue with completing the initial deployment then on a subsequent deployment change the defaultManagementGroup value to the management group name.
The text was updated successfully, but these errors were encountered: