I have an Input which includes a string array (`su...
# general
I have an Input which includes a string array (
) and need to convert it to an
(so an array of string inputs). How can I do this?
Figured it out:
Copy code
export const publicSubnetIds = infra.requireOutputValue('publicSubnetIds');
export const publicSubnetId1 = pulumi.output(publicSubnetIds)[0];
export const publicSubnetId2 = pulumi.output(publicSubnetIds)[1];
There's a few improvements that you can make there. requireOutputValue returns a Promise extracted from an Output, which you then immediately wrap in an Output (twice). So you can replace requireOutputValue with requireOutput and then drop the two calls to pulumi.output().
I'm not sure how
is working, since
should be a Promise<string[]> which isn't indexable. If there's some Pulumi magic and lifting going on, then great. Otherwise, that might be compiling because of the magic of any? Is it working in this form?
I would probably be looking to await something in order to export subnet IDs from an awsx VPC...
Can you use await in pulumi TS files?
I am not sure how it works either, but it does 😄