https://pulumi.com logo
#aws
Title
# aws
l

little-cartoon-10569

03/09/2021, 1:17 AM
I need to pass an availability zone to the constructor of a VpnGateay (don't know if it's a zone name or ID, can sort that later). I presume I get this from the subnets that I've created using awsx.ec2.Vpc.
The problem is that vpc.subnets returns a Promise, so when I try to get the availability zone from them, I'm return an Output<Promise<string>>.
availabilityZone: vpc.privateSubnets.then((subnets) => subnets[0].subnet.availabilityZone)
Which causes an error: Type 'Promise<string | Output<string>>' is not assignable to type 'Promise<string>'
Can I safely avoid this by wrapping it in an output? Will Pulumi unwrap any number of outputs / promises in order to get to a value?
availabilityZone: pulumi.output(vpc.privateSubnets).apply((subnets) => subnets[0].subnet.availabilityZone)