Assuming the following yaml
input file
admins:
members:
- john@gmail.com
- peter@gmail.com
viewers:
members:
- maria@gmail.com
- john@gmail.com
that is passed to var.memberships
via yamldecode
, is it possible to produce a list of objects that has the member
as key
and the groups it belongs to as values, i.e. something like
{
"maria@gmail.com" = {
groups = ["viewers"]
},
"john@gmail.com" = {
groups = ["admins", "viewers"]
},
"peter@gmail.com" = {
groups = ["admins"]
}
}