Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 3 additions & 32 deletions src/constructs/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export interface ISubnetsProps {
readonly routes?: AddRouteOptions[];
readonly tags?: Record<string, string>;
readonly useSubnetForNAT?: boolean;
readonly isMigration?: boolean;
}
export interface VPCProps {
readonly vpc: ec2.VpcProps;
Expand Down Expand Up @@ -259,12 +258,12 @@ export class Network extends Construct {
}

// Create a single RouteTableManager for the entire subnet group if migration is enabled
const routeTableManager = option.isMigration ? new RouteTableManager(this, `${option.subnetGroupName}RouteTableManager`, {
const routeTableManager = new RouteTableManager(this, `${option.subnetGroupName}RouteTableManager`, {
vpc,
subnetGroupName: option.subnetGroupName,
routes: option.routes,
peeringConnectionId,
}) : undefined;
});

option.availabilityZones.forEach((az, index) => {
let subnet: ec2.PrivateSubnet | ec2.PublicSubnet =
Expand All @@ -289,35 +288,7 @@ export class Network extends Construct {
mapPublicIpOnLaunch: false,
},
);
if (option.isMigration && routeTableManager) {
routeTableManager.associateSubnet(subnet, index);
} else {
option.routes?.forEach((route, routeIndex) => {
if (peeringConnectionId != undefined && route.existingVpcPeeringRouteKey != undefined) {
let routeId: ec2.CfnVPCPeeringConnection | undefined = peeringConnectionId[route.existingVpcPeeringRouteKey];
if (routeId != undefined) {
subnet.addRoute(
`${option.subnetGroupName}${routeIndex}RouteEntry`,
{
routerId: routeId.ref,
routerType: route.routerType,
destinationCidrBlock: route.destinationCidrBlock,
},
);
}
} else if (route.routerId != undefined) {
subnet.addRoute(
`${option.subnetGroupName}${routeIndex}RouteEntry`,
{
routerId: route.routerId ?? '',
routerType: route.routerType,
destinationCidrBlock: route.destinationCidrBlock,
},
);
}
});
}

routeTableManager.associateSubnet(subnet, index);
Tags.of(subnet).add(SUBNETNAME_TAG, option.subnetGroupName);
Tags.of(subnet).add(SUBNETTYPE_TAG, option.subnetType);
if (option.tags != undefined) {
Expand Down