(aws-ec2): Vpc creates EgressOnlyInternetGateway without private subnets #30981
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
When creating a Dual Stack VPC, an EgressOnlyInternetGateway is created even if there are no private subnets. This comes from a vaulty condition, in
vpc.ts
:aws-cdk/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts
Lines 1644 to 1647 in 3f93027
this.privateSubnets
check will also evaluate to true on empty arrays.Expected Behavior
No EgressOnlyInternetGateway is created without private subnets
Current Behavior
EgressOnlyInternetGateway is created without private subnets
Reproduction Steps
Possible Solution
Check the length:
Additional Information/Context
No response
CDK CLI Version
2.150.0 (build 3f93027)
Framework Version
No response
Node.js Version
v22.5.1
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: