Hey, is there a nice way here to get all of the ro...
# typescript
Hey, is there a nice way here to get all of the route tables for my VPC? As you can see from my attempt, I can't get an array of the routeTable Ids:
Copy code
const vpc = new awsx.ec2.Vpc("BaseNetworkVPC", {
    cidrBlock: "",
    subnets: [
        { type: "public" },
        { type: "private" },

// this is probably wrong, but not sure how to proceed!
const vpcPrivateSubnets = pulumi.output(vpc.privateSubnets).apply(psns => psns.map(psns => psns.routeTable?.id));

// I want to make a routeTable propagation for each of my VPC's private subnets
const routeTablePropagation2 = new aws.ec2.VpnGatewayRoutePropagation("VPGPropagateMainRouteTable", {
        vpnGatewayId: gatewayAssociation.associatedGatewayId,
        routeTableId: // what goes here?
More generically - how do I retrieve a collection of resources and then iterate over them to make more resources?
Most of our resources have a
function. For route tables, we've got
: https://www.pulumi.com/docs/reference/pkg/aws/ec2/getroutetables/#getroutetablesfilter You can pass in the vpc id into the filter arguments and that should return the route tables for that VPC
A bit further, but now I am not allowed to use the Vpc I made earlier's ID?
Copy code
const privateRouteTables = aws.ec2.getRouteTables({
    vpcId: vpc.id,
    filters: [
            name: 'association.subnet-id',
            values: pulumi.output(vpc.privateSubnetIds).apply(snids => snids)
Copy code
// line 2
Type 'Output<string>' is not assignable to type 'string | undefined'.
  Type 'Output<string>' is not assignable to type 'string'.
I tried this:
vpcId: vpc.id.apply(id => id),
with the exact same error as above
My feeling here is that you can't ever go from
Yes, you need to use the id inside the apply(). You don't return it from the apply.