How to swap the keys and values of a map in terraform?

You can use terraform transpose() function to swap the keys and values of a map. transpose() takes a map of lists of strings and swaps the keys and values to produce a new map of lists of strings.

Syntax: transpose(map)

Example:

Leave a Reply