Hi, I'm curious what the dangers of lifting a valu...
# python
d
Hi, I'm curious what the dangers of lifting a value from an output are? Assuming that we limit it to
.get()
outputs or Stackreferences, how safe would something like this be (which does work for k8s `ConfigMap.get()`:
Copy code
import typing
import pulumi
from pulumi.runtime.sync_await import _sync_await
T_co = typing.TypeVar("T_co", covariant=True)
def extract(o: pulumi.Output[T_co]) -> T_co:
    if not _sync_await(o.is_known()):
        raise RuntimeError("Output is not known yet")
    return _sync_await(o.future())
(using the hidden
_sync_await
for convenience to lift out an awaitable)
to be clear, not using this in production. Just experimenting
our usecase is we generate namespaces/services based on the contents of a configmap. Was just seeing if there's a to do it with pulumi machinery (we currently use
python-kubernetes
for it, though this requires us to have an external kubeconfig already setup)