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

enough-leather-70274

04/13/2021, 3:18 AM
Sorry folks, I'm feeling a bit stupid right now... I'm trying to log out the string value of a stack reference from one stack in another.
I've read https://www.pulumi.com/docs/intro/concepts/stack/#stackreferences and https://www.pulumi.com/docs/intro/concepts/inputs-outputs/ but I'm still struggling. The first stack exports the values fine:
Copy code
pulumi.export("availability_zone_names", vpc.availability_zone_names)
Then in my other stack:
Copy code
stack = pulumi.StackReference(f"{the_first_stack}")
az_names = stack.require_output("availability_zone_names")
print(az_names)
b

billowy-army-68599

04/13/2021, 3:21 AM
if you want to log it, you'll have to do it inside an apply because it's resolved async
Copy code
az_names.apply(lambda args: <http://pulumi.log.info|pulumi.log.info>(f'Availability Zones: {args}') )
e

enough-leather-70274

04/13/2021, 3:26 AM
Yup, my bad. Duh. I was trying to print the result of the apply rather than log from within the lambda func