Hi all, is there a way to get stack output from pu...
# python
h
Hi all, is there a way to get stack output from pure python without using pulumi cli? Something like the following (doesn’t work)
Copy code
import pulumi        
ref = pulumi.stack_reference.StackReference(name="unused", stack_name="stack")
resp = ref.get_output("output1")
print(resp)
And running the above with
python file.py
b
You need to do an apply for an output. Have you read https://www.pulumi.com/docs/concepts/inputs-outputs/
h
I did try apply as well and that did nothing
Copy code
import pulumi        
ref = pulumi.stack_reference.StackReference(name="unused", stack_name="stack")
resp = ref.get_output("output1").apply(print)
I suspect apply would only work if run via pulumi cli
b
oh, yes, they’re only available in the pulumi CLI
c
I am interested in this as well. Is there a way to execute pure Python script with Pulumi context so the values can be fetched? Something like this:
Copy code
pulumi run file.py
m
The automation api
c
Thank you so much. What I needed was Automation API's Local Program 👍