(aws-ec2): SubnetSelection Returns - Error: Cannot create a VPC Endpoint with no subnets #32460
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p1
Describe the bug
When creating a Interface VPC Endpoint and using the
availabilityZones
filter on theSubnets
property you will get a "Error: Cannot create a VPC Endpoint with no subnets" message when no context is present incdk.context.json
.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The
availabilityZones
is a property of theSubnetSelection
interface. The expectation here is that setting an availability zone will filter all the subnets and only specify the ones that match that availability zone.Current Behavior
Currently, the following validation error is being returned: "Error: Cannot create a VPC Endpoint with no subnets."
Reproduction Steps
Using the following code snippet, perform a
cdk synth
and ensure yourcdk.context.json
file is empty.Possible Solution
No response
Additional Information/Context
When creating the VPC, use the
availabilityZones
property instead of themaxAzs
property. When the VPC created makes use of theavailabilityZones
property, this error does not occur.Testing with other constructs that implement the
SubnetSelection
interface, I confirmed that with an emptycdk.context.json
and specifying theavailabilityZones
property, no subnets will be returned.CDK CLI Version
2.171.0
Framework Version
No response
Node.js Version
v22.2.0
OS
macOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: