Is there a way to manually register stack outputs ...
# general
m
Is there a way to manually register stack outputs other than (for i.e. typescript) exporting at the top level.
w
No - not currently. What's the scenario where you need this? Note that you can though do something like:
Copy code
export let myExport;

function doSomething() {
  ...
  myExport = value;
 ...
}

doSomething();
m
Ah okay, I think that will solve my problem. Let me try it out
It would be nice to have
pulumi.export
in typescript. I am having to return a value up through additional layers to export it at the true entrypoint file. These layers exist to make typescript module aliases work, and have no real semantic hierarchical meaning.
It seems like this trick should work, but I'm not seeing my export. I'm also trying to export a
Provider
though which I'm not sure is serializable/supported
w
Yes - I'm not sure a
Provider
instance will serialize well. You likely need to export the data you use to construct it, and then construct the
Provider
instance itself inside other stacks that need it.
m
Got it, would be pretty magical to just export / import a provider object between stacks (one stack creates a k8s cluster, another uses the provider from it), but I understand there are probably lots of difficulties to do that.
w
Indeed! I'm not yet sure exactly how we would make that work. In fact, when we added the JSON-serialization of stack exports, I guessed that this would immediately make folks also want to be able to rehydrate whole resource objects 🙂 https://github.com/pulumi/pulumi/pull/2311#issuecomment-448793150 cc @lemon-spoon-91807
👍 1
m
Is there a way to grab the
kubeconfig
string back out of a
k8s.Provider
that I am just missing?