https://pulumi.com logo
#typescript
Title
# typescript
w

witty-monitor-18849

11/22/2021, 7:14 PM
Is there a way to get an
Output<string>
to work as an argument to a function like [getsubnetids](https://www.pulumi.com/registry/packages/aws/api-docs/ec2/getsubnetids/) where arguments are of type
string
and not
Input<string>
? Such as:
Copy code
const publicSubnets = ec2.getSubnetIds({
	  vpcId: vpc.id, // Correctly results in "Type Output<string> is not assignable to type 'string'
      tags: {
        type: "public",
      },
    })
g

green-school-95910

11/22/2021, 7:40 PM
You need to call
apply
and get the promise inside the callback. This wil wrap the promise in an output and resolve it withing Pulumi resource graph
Copy code
const publicSubnets = vpc.id.apply(vpcId => ec2.getSubnetIds({
	  vpcId: vpcId,
      tags: {
        type: "public",
      },
    }))
w

witty-monitor-18849

11/22/2021, 10:57 PM
Many thanks @green-school-95910, that has worked for me 🙏