is it expected that values in loops get lost/lifted to global scope when using `Output.apply`?
i
is it expected that values in loops get lost/lifted to global scope when using
Output.apply
?
for example, suppose i have the following
Copy code
my_list = [('a', 1), ('b', 2)]
Copy code
stack_ref = pulumi.StackReference(...)
Copy code
values = [ stack_ref.get_output(key).apply(lambda output: f"{number}={output}") for key, number in my_list ]
when i run that, the value for
number
inside the lambda is always
2
e
yeh, its the same as a normal python lambda closure. It capture by variable name, not by value. https://stackoverflow.com/questions/2295290/what-do-lambda-function-closures-capture