How to sort a list based on the values in terraform?

You can use terraform sort() function to sort a list based on the values. sort() takes a list of strings and returns a new list with those strings sorted lexicographically. The sort is in terms of Unicode codepoints, with higher codepoints appearing after lower ones in the result.

Syntax: sort(list)

Example:

Leave a Reply