@@ -62,7 +62,6 @@ export interface ISubnetsProps {
6262 readonly routes ?: AddRouteOptions [ ] ;
6363 readonly tags ?: Record < string , string > ;
6464 readonly useSubnetForNAT ?: boolean ;
65- readonly isMigration ?: boolean ;
6665}
6766export interface VPCProps {
6867 readonly vpc : ec2 . VpcProps ;
@@ -259,12 +258,12 @@ export class Network extends Construct {
259258 }
260259
261260 // Create a single RouteTableManager for the entire subnet group if migration is enabled
262- const routeTableManager = option . isMigration ? new RouteTableManager ( this , `${ option . subnetGroupName } RouteTableManager` , {
261+ const routeTableManager = new RouteTableManager ( this , `${ option . subnetGroupName } RouteTableManager` , {
263262 vpc,
264263 subnetGroupName : option . subnetGroupName ,
265264 routes : option . routes ,
266265 peeringConnectionId,
267- } ) : undefined ;
266+ } ) ;
268267
269268 option . availabilityZones . forEach ( ( az , index ) => {
270269 let subnet : ec2 . PrivateSubnet | ec2 . PublicSubnet =
@@ -289,35 +288,7 @@ export class Network extends Construct {
289288 mapPublicIpOnLaunch : false ,
290289 } ,
291290 ) ;
292- if ( option . isMigration && routeTableManager ) {
293- routeTableManager . associateSubnet ( subnet , index ) ;
294- } else {
295- option . routes ?. forEach ( ( route , routeIndex ) => {
296- if ( peeringConnectionId != undefined && route . existingVpcPeeringRouteKey != undefined ) {
297- let routeId : ec2 . CfnVPCPeeringConnection | undefined = peeringConnectionId [ route . existingVpcPeeringRouteKey ] ;
298- if ( routeId != undefined ) {
299- subnet . addRoute (
300- `${ option . subnetGroupName } ${ routeIndex } RouteEntry` ,
301- {
302- routerId : routeId . ref ,
303- routerType : route . routerType ,
304- destinationCidrBlock : route . destinationCidrBlock ,
305- } ,
306- ) ;
307- }
308- } else if ( route . routerId != undefined ) {
309- subnet . addRoute (
310- `${ option . subnetGroupName } ${ routeIndex } RouteEntry` ,
311- {
312- routerId : route . routerId ?? '' ,
313- routerType : route . routerType ,
314- destinationCidrBlock : route . destinationCidrBlock ,
315- } ,
316- ) ;
317- }
318- } ) ;
319- }
320-
291+ routeTableManager . associateSubnet ( subnet , index ) ;
321292 Tags . of ( subnet ) . add ( SUBNETNAME_TAG , option . subnetGroupName ) ;
322293 Tags . of ( subnet ) . add ( SUBNETTYPE_TAG , option . subnetType ) ;
323294 if ( option . tags != undefined ) {
0 commit comments