Some AWS resources only accept a collection of subnets from unique Availability Zones (AZs). Its easy to achieve this in the AWS Management Console, or via a programming language with the use of an intermediate data structure. However, it becomes a bit more complex when trying to define it in a declarative manner like in Terraform. Fortunately, this is still achievable with Terraform - we just need with a nested for-loop within the if-condition of the outer for-loop