# NOTE: By using a map type, we take advantage of the keys being ordered in ascending order to arrange the AZs as a → c → d subnet_id = values({ for id, s in data.aws_subnet.public : s.availability_zone => id })[count.index % local.az_count]
That’s all. I hope this is helpful.
Sorting a map by key in Terraform and getting the list of values