I’m following the example here, but this line does...
# general
d
I’m following the example here, but this line doesn’t work, is there any way I can use the value in the output? https://github.com/pulumi/pulumi-aws/blob/master/sdk/nodejs/ec2/getSubnetIds.ts#L24
w
Yes - that example unfortunately looks incorrrect. Here's something that works for me and does the same thing:
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

async function getAllSubnets(): Promise<aws.ec2.GetSubnetResult[]> {
    const subnetIds = await aws.ec2.getSubnetIds({
        vpcId: "vpc-c93b06ae",
    });

    const results: aws.ec2.GetSubnetResult[] = [];
    for (const subnetId of subnetIds.ids) {
        const subnet = await aws.ec2.getSubnet({
            id: subnetId,
        });
        results.push(subnet);
    }

    return results;
}

export const allSubnets = getAllSubnets();
d
This works, thanks!