Skip to content

Commit 5330176

Browse files
committed
patch(feat): octo-aws-cdk route table to associate igw conditionally.
1 parent 7b7698d commit 5330176

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/octo-aws-cdk/src/resources/route-table/actions/add-route-table.resource.action.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ export class AddRouteTableResourceAction implements IResourceAction {
5454
SubnetId: subnetResponse.SubnetId,
5555
}),
5656
),
57-
ec2Client.send(
58-
new CreateRouteCommand({
59-
DestinationCidrBlock: '0.0.0.0/0',
60-
GatewayId: internetGatewayResponse.InternetGatewayId,
61-
RouteTableId: routeTableOutput!.RouteTable!.RouteTableId,
62-
}),
63-
),
57+
properties.associateWithInternetGateway
58+
? ec2Client.send(
59+
new CreateRouteCommand({
60+
DestinationCidrBlock: '0.0.0.0/0',
61+
GatewayId: internetGatewayResponse.InternetGatewayId,
62+
RouteTableId: routeTableOutput!.RouteTable!.RouteTableId,
63+
}),
64+
)
65+
: Promise.resolve(),
6466
]);
6567

6668
// Set response.

packages/octo-aws-cdk/src/resources/route-table/route-table.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface IRouteTableProperties {
2+
associateWithInternetGateway: boolean;
23
awsRegionId: string;
34
}
45

0 commit comments

Comments
 (0)