https://pulumi.com logo
#docs
Title
# docs
s

shy-waiter-84958

07/31/2020, 3:51 PM
Not sure if this is the right place to address this. The example here for Typescript does not work since we migrated to V2 (are docs still pending v2 Updates for examples?) https://www.pulumi.com/docs/reference/pkg/aws/ec2/getroutetables/ Getting this error on the for loop for the rts.apply
Copy code
Operator '<' cannot be applied to types 'number' and 'OutputInstance<number>'
f

faint-table-42725

07/31/2020, 5:17 PM
Thanks for pointing this out! The examples are code-generated, so that’s a bug and I’ve filed an issue for it.
Let me know if you need help getting a working example or if you’ve figured it out
s

shy-waiter-84958

07/31/2020, 5:40 PM
If you can provide a functional example that would be super helpful! This particular thing has me stalled in setting up several peer connections and adding them to routes tables in our VPC. I have been trying to use the route ids from the crosswalk VPCX module or using the get function, both require using .apply to get the ids which makes iterating in any form very difficult. (especially for a typescript/node/js amateur.)
f

faint-table-42725

07/31/2020, 6:32 PM
The easiest is probably just treat it as the Promise that it is:
Copy code
const rts = aws.ec2.getRouteTables({
    filters: [{
        name: "tag:<http://kubernetes.io/kops/role|kubernetes.io/kops/role>",
        values: ["private*"],
    }],
    vpcId: var_vpc_id,
}));

rts.then(r => {
    const route: aws.ec2.Route[] = [];
    for (let i = 0; i < r.ids.length); i++) {
    route.push(new aws.ec2.Route(`r-${i}`, {
        destinationCidrBlock: "10.0.1.0/22",
        routeTableId: r.ids[i],
        vpcPeeringConnectionId: "pcx-0e9a7a9ecd137dc54",
    }));
});
s

shy-waiter-84958

07/31/2020, 6:55 PM
I think that got me through my blockage, but I had to make some changes (syntax issues). Once I get it to apply cleanly I'll post the changes I made to make it work if you want.
f

faint-table-42725

07/31/2020, 7:27 PM
Awesome — glad to hear! No need to post back w/ your changes