https://pulumi.com logo
#python
Title
# python
d

dazzling-answer-16144

07/13/2022, 12:43 AM
So this may be a dumb question but I'm struggling to understand how to feed the results of
aws.ec2.get_subnets()
into the arguments of
aws.ec2.get_subnet()
as the former returns an awaitable which is not accepted by the latter, am I missing anything? Sample (broken code):
Copy code
subnet_ids = await aws.ec2.get_subnets(
        filters=[
            aws.ec2.GetSubnetsFilterArgs(
                name="vpc-id",
                values=[vpc_id],
            )
        ]
    )
    subnet = aws.ec2.get_subnet(id=subnet_ids[0])
e

echoing-dinner-19531

07/13/2022, 10:41 AM
Either use
get_subnet_output
that allows promises and outputs as part of the input arguments, but the result will now be an Output. Or await the result of get_subnets before calling into get_subnet (it's just a standard asncio task https://docs.python.org/3/library/asyncio-task.html)
6 Views