I've created a VPC like this
vpc = new Vpc(theStack, vpcName,
VpcProps.builder()
.cidr("10.0.0.0/16")
.build());
In eu-west-1, by default I get 3 public and 3 private subnets. The private subnets will have a NAT Gateway.
Now, we're trying to remove the NAT Gateways (because of cost), so I tried this
vpc = new Vpc(theStack, vpcName,
VpcProps.builder()
.maxAzs(3)
.cidr("10.0.0.0/16")
.subnetConfiguration(List.of(
SubnetConfiguration.builder()
.subnetType(SubnetType.PUBLIC)
.name("Public")
.cidrMask(24)
.build(),
SubnetConfiguration.builder()
.subnetType(SubnetType.ISOLATED)
.name("Private")
.cidrMask(24)
.build()))
.build());
Creating this in a fresh stack works fine. I get a VPC with the same subnets as before and no NAT GW:s. But, running this to modify the VPC created above, results in name clashes.
Is there some way I can get cdk/cloudformation to understand that I want to modify the existing private subnets and not create new ones?