How to unite data from lists?

for additional users


output "test_role_ids_Nusers" { value = [for u in local.cloud_config.user : flatten([for i in u.role_labels : [for r in local.cloud_config.role : r.id if r.label == i ] ]) ] }