-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-cdk-lib/aws-ec2): selectSubnets not handling CloudWAN Subnet correctly #32488
Comments
@VardyNg Thanks for detailed analysis and PR. Could you also please point to documentation which specifies that for a CloudWAN Subnet, |
@ashishdhingra Please refer to internal ticket ID: 2ea4b9ce-ef13-4dd8-b422-bcc505869f33 |
Internal Ticket: V1604202007 |
Not sure if subnets with CloudWAN as default route should be classified as |
@pahud Draft PR #32494 has been contributed by requestor, but we need to validate if default route in CloudWAN should be classified as |
Yes, I drafted that PR in case it is required, agree that we should validate if it is the correct classification. |
Describe the bug
CloudWAN create a global network for VPC, Data Centres, and branch offices.
When configuring VPC to join the network, we create VPC Attachment, then configure Subnet Route Table to direct traffic to the CloudWAN network.
This set up is similar to using TGW, where we create an attachment and configure Subnet Route Table.
However, when using the selectSubnets function to query subnets from VPC, the CloudWAN Subnet is being considered as
PRIVATE_ISOLATED
, instead ofPRIVATE_WITH_EGRESS
which categorizes the TGW Subnet.Refer to the related source code, it appears that the selectSubnets function does not take
CloudWAN
into consideration, but onlyIGW
,NAT Gateway
, andTGW
.https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/context-providers/vpcs.ts#L79
Please advice whether this behaviour is expected, or not CloudWAN is missed from the current subnet selection logic.
Regression Issue
Last Known Working CDK Version
Latest, as appeared the main branch
Expected Behavior
"CloudWAN Subnet" to be categorized as
PRIVATE_WITH_EGRESS
Current Behavior
"CloudWAN Subnet" being categorized as
PRIVATE_ISOLATED
Reproduction Steps
Deploy a CloudWAN and Configure a "CloudWAN Subnet"
Here I use Terraform
Note that the above created a subnet with ID
subnet-0acf41adc9e62d5e7
Use AWS CDK to query VPC subnets
Test:
CDK version:
CDK clear context value
Run CDK Synthesize to query subnets
npx cdk synthesize private_isolated_subnet [ 'subnet-0acf41adc9e62d5e7' ]
As shown above, the subnet-0acf41adc9e62d5e7 is being considered as
PRIVATE_ISOLATED
Possible Solution
Implement an additional function in RouteTable class
hasRouteToCloudWAN
, use this function in readVpcProps to check subnet CloudWAN config, and set subnet type asSubnetType.Private
.Additional Information/Context
No response
CDK CLI Version
2.172.0 (build 0f666c5)
Framework Version
No response
Node.js Version
v20.11.1
OS
macOS
Language
TypeScript
Language Version
5.3.3
Other information
No response
The text was updated successfully, but these errors were encountered: