Where is the equivalent to `pulumi/getStack()` fro...
# java
p
Where is the equivalent to
pulumi/getStack()
from the JS/TS SDK?
m
Copy code
Pulumi.run(ctx -> { ctx.stackName() }
https://www.pulumi.com/docs/reference/pkg/java/com/pulumi/Context.html
p
Thanks!
How do I get a reference to the context outside of
run
?
e.g. I have a source file that I’m trying to convert from JS to [a JVM language] and in the JS
getStack
is equivalent to a static method I think — no instance of anything needed.
it “just works”
m
I don't think we enable that since
Pulumi.run
runs a function inside of the engine. I think you'd have to pass
Context
around. We don't support
Context.getCurrentStackName()
(yet?) You could probably implement it with some sort of wrapper function/Class around
Pulumi.run
to set a singleton
p
huh, interesting. I’ll play around with it. Thank you!