There is a known limitation of the AWS provider that prevents inline routes and ec2.Route constructs from working reliably inside a RouteTable definition.
This prevents consumers of the VPC component from adding routes to the VPC's route tables. We'd like to do this to establish a peering connection between accounts for cross-account databases, where the peering connection allows for ingestion of our application database tables into our data warehouse.
Here's a dummy example:
const vpc = new sst.aws.Vpc('VPC', {
bastion: true,
nat: 'ec2',
});
vpc.nodes.privateRouteTables.apply((routeTables) => {
routeTables.map((table, idx) => {
new aws.ec2.Route(`PeeringRoute${idx}`, {
routeTableId: table.id,
vpcPeeringConnectionId: 'pcx-foo',
destinationCidrBlock: '9.9.9.9/16',
});
});
});
While this works some of the time, the limitation leads to state sync errors that bring the peering connection offline and force us to manually rectify.
Request
Use ec2.Route instead of inline routes in createPublicSubnets and createPrivateSubnets in the vpc component.
There is a known limitation of the AWS provider that prevents inline routes and
ec2.Routeconstructs from working reliably inside aRouteTabledefinition.This prevents consumers of the
VPCcomponent from adding routes to theVPC's route tables. We'd like to do this to establish a peering connection between accounts for cross-account databases, where the peering connection allows for ingestion of our application database tables into our data warehouse.Here's a dummy example:
While this works some of the time, the limitation leads to state sync errors that bring the peering connection offline and force us to manually rectify.
Request
Use
ec2.Routeinstead of inlineroutesincreatePublicSubnetsandcreatePrivateSubnetsin thevpccomponent.