Open danie1blackmore opened 1 month ago
Hi - this is strange as we use the management group association resource to manage this - what does your module input look like?
Hi,
It's pretty typical of some of the examples. While testing I'm just hard-coding, but variables would eventually be used. Just to note as well I wasn't able to copy and paste so just had to re-type the below. The original code works without errors so the inputs appear correct.
module lz_vending {
source = "azure/lz-vending/azurerm"
subscription_id = "subid"
subscription_alias_enabled = false
subscription_billing_scope = ""
subscription_display_name = "test sub"
subscription_alias_name = "test sub"
subscription_workload = "production"
subscription_management_group_id = "contoso-online"
}
At the moment, the subscription is currently under the "contoso-sandbox" management group id, and running a terraform plan doesnt detect it or apply doesn't change it.
Just to note as well, I tried to use the azurerm_management_group_subscription_association as outlined in the terraform documentation (using the data blocks as well) which did successfully associate to the correct management group using the exact same information as outlined above, so it looks like it's something within the lz_vending module rather than the azurerm module
data azurerm_management_group test {
name = "contoso-online"
}
data azurerm_subscription test {
subscription_id = "subid"
}
resource azurerm_management_group_subscription_association test {
management_group_id = data.azurerm_management_group.test.id
subscription_id = data.azurerm_subscription.test.id
}
Community Note
Versions
Please paste the output of
terraform version
command from within the initialized directory:Please enter the module version that you are using:
Description
When making future changes to the subscription, the changes are not applied. For example, if the subscription was previously placed in the contoso-management management, changing the subscription_management_group_id to contoso-connectivity and then running a
terraform apply
does not re-associate the subscription to the contoso-connectivity management groupSteps to Reproduce
terraform apply
terraform apply
Following this, the subscription should still be in the original management group
Screenshots
Additional context
No workaround found for changing management group ids - instead just a manual move.