Wondering if there's a way with the AWS CDK to list all the available VPCs for the current account.
For example the CLI provides aws ec2 describe-vpcs which is very handy to retrieve all the available VPCs.
I can also import a VPC if I know its identifier (python example) :
vpc = ec2.Vpc.from_lookup(self, "vpc", vpc_id=vpc_id)
However at this point, I haven't found a way to retrieve all (or filtered) VPCs (or their ids) using the CDK. Any pointers ?
Note : we're currently passing a CIDR block string to the cdk command line so we can configure the cidr parameter of the aw2s_ec2.Vpc constructor. We would like to avoid that and let the application find the next available CIDR block on its own (or the one that was used for this deployment if previously created). For example, Vpc.private_subnets offers a way to list all private subnets (and their CIDR blocks) for an existing vpc, so I would have assumed the same could be obtained for vpcs in an AWS account.