Template over map


Terraform 0.12 introduced new string templates:

%{ for ip in aws_instance.example.*.private_ip }
server ${ip}
%{ endfor }

I’d like to ask can it iterate over a map? Like:

%{ for ip, name in var.my_cool_map }
${name} ${ip}
%{ endfor }

If no, how can I achieve that?
Like in 0.11, create an additional template and use count?

Hi @okgolove!

What you tried there looks like it should work to me. Did you encounter an error or unexpected behavior when you tried it?

Hi. Sorry for the late answer.
It seems it works properly but that wasn’t clear for me because of it’s missing in the documentation. It would be great if you added an example with maps to the doc.
Thank you!