Wanted to use this solution, but when deploying to a region with only three AZ's (us-east-2) and selecting all three AZ's, Cloudformation would error on the forth CIDR blocks, saying invalid CIDR block defined.
This worked fine in a region with four AZ's when the four AZ's are selected.