acceptable-army-69872
10/01/2019, 4:43 PMObject is possibly 'undefined'.
. I get it, it's possible for a route table not to be associated, we're type safe, cool. I tried a few things like let x: string | undefined
but didn't get very far. what the google foo i need to figure this kind of thing out const allSubnets = vpc.privateSubnets.concat(vpc.publicSubnets)
for (var sn of allSubnets) {
var rtid = sn.routeTableAssociation.routeTableId;
}
const allSubnets = vpc.privateSubnets.concat(vpc.publicSubnets)
let peeringRoutes: aws.ec2.Route[] = [];
let it = 0;
for (var sn of allSubnets) {
if (sn.routeTableAssociation === undefined) {
continue;
}
peeringRoutes.push(
new aws.ec2.Route(`vpc-peering-route-${it}`, {
destinationCidrBlock: "10.200.1.0/24",
routeTableId: sn.routeTableAssociation.routeTableId,
vpcPeeringConnectionId: workspaceToC1PeeringConnection.id
})
);
it++;
}