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

elegant-smartphone-60282

08/25/2022, 12:07 PM
Hey i have this code
Copy code
public_subnets = dis_stack.get_output("public_subnets")

subnets_list = public_subnets.apply(lambda id: id)
but it returns an output object, how can i do that i get a list ?
s

stocky-restaurant-98004

08/25/2022, 2:08 PM
Try applying on
id
. If
public_subnets
is not an output, then you'll want to do something like (and pardon my Python)
plain_old_list_of_strings = public_subnets.map(lambda id: id.apply(lambda x: x))
l

little-cartoon-10569

08/25/2022, 9:08 PM
Does this work in Python? In general, if something is an output at a particular depth of code, you shouldn't be able to get the thing inside the output at that level of code, ever. You need to access the thing (id, list, whatever) inside an apply, or equivalent.
Outputs are promises of a future value. By definition, the value isn't known at the time the code runs. You can't turn an output into a non-output.
3 Views