This message was deleted.
# general
s
This message was deleted.
o
For now you must use Apply (which will yield an Output[str]), but you can follow this issue for updates on getting plain, non-output values: https://github.com/pulumi/pulumi/issues/10839
e
I think the worst case is I spawn a new process to call “pulumi stack output some-output” directly and parse the result. Before going to this, any other approaches?
o
There is almost always a way to do what you want using apply, so I'd be surprised if your use case wasn't handled. If you want to print out the string, put the print in an apply. Make an http request with it? In an apply. All resources accept Outputs for their args.
The reason we do this is to protect secrets and track dependencies. We're evaluating whether we should allow an escape hatch to "await" an output directly, but if misused it can cause secret values to leak or certain operations to fail, especially replacements and destroys.
e
This'll probably be in the next release (or at least the one after that). We're adding new get methods that return a tuple of { value: string, secretValue: string }, so you always get a plain value but you need to check if it's secret or not yourself and handle that.
e
@echoing-dinner-19531 Possible to inform me some internal function that I can hack it now. I don’t care about stability.
e
This is python so there is an undocumented function on Output,
o.future()
returns an
Awaitable[T]
Will work fine for this because stack refs are always known, but it can return None for some outputs. And clearly you lose tracking of any secret bit or dependencies.
e
For this simple code
Copy code
from pulumi import StackReference
import asyncio

async def main():
    stack = StackReference(f"some-stack")
    fut = stack.require_output("some-output").future()
    ret = await fut


asyncio.run(main())
It fails claiming some errors like
Copy code
attached to a different loop
e
I do not know asyncio well enough to suggest much here, but that is all that StackReference is doing internally.