Iterate from output

Hello,

I have this code as output of a module:

~ instances = 
   [
      ~ {
          ~ test = {                                                                                     
                instances      = [                                                                       
                    "XX.XX.XX.XX",                                                                       
                ]                                                                                        
              ~ instances_all  = [                                                                       
                  ~ {                                                                                    
                        access_ip_v4            = "XX.XX.XX.XX" 
                        access_ip_v6            = "" 
                        admin_pass              = null
                        all_metadata            = {} 
                        all_tags                = [] 
                        availability_zone       = "XXX"
                        availability_zone_hints = null
                        block_device            = [
                            {
                                boot_index            = 0
                                delete_on_termination = true
                                destination_type      = "volume"
                                device_type           = ""
                                disk_bus              = ""
                                guest_format          = ""
                                source_type           = "volume"
                                uuid                  = "abd71790-a217-4531-bd19-9ed9111a0e56"
                                volume_size           = 15
                                volume_type           = ""
                            },
                            {
                                boot_index            = 1
                                delete_on_termination = false
                                destination_type      = "volume"
                                device_type           = ""
                                disk_bus              = ""
                                guest_format          = ""
                                source_type           = "volume"
                                uuid                  = "85f60ac9-aa82-43fb-b9b7-767831bb21a2"
                                volume_size           = 0
                                volume_type           = ""
                            },
                        ]
                        config_drive            = null
                        flavor_id               = "69d53798-ee75-4f70-8f00-58dc51661ace"
                        flavor_name             = "small"
                        floating_ip             = null
                        force_delete            = false
                        id                      = "222ebdae-cb2c-4999-bf41-44dd1b0fc6f9"
                        image_id                = "Attempt to boot from volume - no image supplied"
                        image_name              = "debian10"
                        key_pair                = "" 
                        metadata                = null
                        name                    = "test-dc1-01"
                        network                 = [
                            {
                                access_network = false
                                fixed_ip_v4    = "XX.XX.XX.XX"
                                fixed_ip_v6    = ""
                                floating_ip    = ""
                                mac            = "fa:16:3e:4b:8b:9b"
                                name           = "internal"
                                port           = ""
                                uuid           = "e1b2e4e8-3f09-4701-9f96-d6a68a8e065c"
                            },
                        ]
                        network_mode            = null
                        personality             = [] 
                        power_state             = "active"
                        region                  = "RegionOne"
                        scheduler_hints         = [] 
                        security_groups         = [
                            "default",
                        ]
                        stop_before_destroy     = true
                      ~ tags                    = null -> []
                        timeouts                = null
                        user_data               = null
                        vendor_options          = [] 
                        volume                  = [] 
                    },
                ]
                instances_fqdn = [
                    "test-dc1-01",
                ]
                instances_id   = [
                    "222ebdae-cb2c-4999-bf41-44dd1b0fc6f9",
                ]
            }
        },
    ]

I would like to know how I can iterate on array instances and instances_all on the same stage ? I would like to get all instances..instances_all..name for example.

Thanks.

This piece of code is working but only on index 0:

module "test" {                                                                                   
  for_each               = module.instance_dc1
  source                 = "git::ssh://git@xxxxxx.xxx/terraform-modules/terraform-netbox-instance?ref=init"
  name                   = each.value.instances_all[0].name                               
}

This piece of code is not working:

module "netbox" {                                                                                   
  for_each               = module.instance_dc1                                                      
  count                  = each.value.instances_all                                                 
  source                 = "git::ssh://git@xxxxxx.xxx/terraform-modules/terraform-netbox-instance?ref=init"
  name                   = each.value.instances_all[count.index].name                               
} 

The error message is Invalid combination of “count” and “for_each”.