Azure / terraform-azurerm-avm-ptn-alz

Terraform module to deploy Azure Landing Zones
https://registry.terraform.io/modules/Azure/avm-ptn-alz/azurerm
MIT License
59 stars 12 forks source link

[AVM Module Issue]: Error: Unsupported attribute in output "management_group_resource_ids" #73

Closed JWilkinsonMB closed 1 week ago

JWilkinsonMB commented 1 week ago

Check for previous/existing GitHub issues

Issue Type?

Bug

(Optional) Module Version

v0.7.0

(Optional) Correlation Id

No response

Description

When attempting to deploy new management groups using the new architecture in 0.7.0 the plan fails with the following error:

Error: Unsupported attribute │ │ on .terraform\modules\alz_global\outputs.tf line 10, in output "management_group_resource_ids": │ 10: ) : k => v.id } │ │ This object does not have an attribute named "id".

The output of the azapi_helper module does not have a value for id, I believe the intent was to use resource_id.

https://github.com/Azure/terraform-azurerm-avm-ptn-alz/blob/a787df5d59c93c15ae370d08fcdad3a6bea455e0/modules/azapi_helper/outputs.tf#L16-L19

https://github.com/Azure/terraform-azurerm-avm-ptn-alz/blob/a787df5d59c93c15ae370d08fcdad3a6bea455e0/outputs.tf#L1-L11

Updating the above as follows appears to resolve the issue:

output "management_group_resource_ids" {
  value = { for k, v in merge(
    module.management_groups_level_0,
    module.management_groups_level_1,
    module.management_groups_level_2,
    module.management_groups_level_3,
    module.management_groups_level_4,
    module.management_groups_level_5,
    module.management_groups_level_6,
  ) : k => v.resource_id }
}
matt-FFFFFF commented 1 week ago

Hi yes you're right. Will be fixed in the next version - likely tomorrow

matt-FFFFFF commented 1 week ago

Now fixed in latest release