I'm writing a few templates to create a stack on demand. Because of the concurrent VPC limitations (5 to start), I'm attempting to create all the feature-based dev environments on a single VPC and mostly divide the stacks by subnets. The idea is that every stack will have 2 private and 2 public subnets. I know I can get specific CIDRs with something like this (YAML):
!Select [ 0, !Cidr [ !GetAtt MyVpc.CidrBlock, 1, 8 ]]
But I need to make sure I'm getting CIDRs that are not being used by some of the other stack. Programmatically, I would get all CIDR blocks from the VPC and then filter all the ones that are used by other subnets, to get a final array (or simply return x items from the array).
Is getting a block of free CIDRs or a single free one something I can do with the intrinsic functions?