Hey i have this code ```public_subnets = dis_stack...
# aws
e
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
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
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.