How to handle resources in multiple availability zones dynamically

I am wondering if it possible to dynamically create a resource such as subnets in aws across multiple availability zones without having to specify the ranges for each, what I’ve tried:

cidr_blocks {
  private = 10.0.0.4/22
  public   = 10.0.4.0/22
}
subnets [private,public]

and then I can get a list of of az’s by doing something like
az_names = data.aws_availability_zones.available.names

Now what I want to do ideally in a single call is create a private and public subnet in each az_name but it doesn’t seem possible I can create two resources for doing a for on the az names and then looking up the private cidr block and private subnet then duplicating this for the public option. However, I’m hoping I can do it in a single block if that makes sense.