https://pulumi.com logo
#general
Title
# general
e

early-intern-90238

10/12/2019, 3:53 PM
Ok I have a really stupid question, how can I extract an export from the stack that was previously exported in a prior run?
I see this in the docs, but perhaps I am dense or something because I don't understand it.
w

white-balloon-205

10/12/2019, 4:01 PM
What do you mean by “extract an export”? From outside the program, you can run
pulumi stack output url
to get the value of the
url
output. To reference outputs of one stack in another stack, you can use
StackReference
.
e

early-intern-90238

10/12/2019, 4:05 PM
Well, I wanted to extract the previous value at the top of my application before it gets overwritten, I guess I could get a reference the same stack I am using I didn't try that...
yeah that works...but I think I am missing something...I just want to pull the value from my current stack
Basically its being used to track versions, I pull prior version, bump it and then export it again...maybe there is a better way...
c

cool-egg-852

10/13/2019, 1:00 PM
From what it sounds like, he wants to do this: 1 Stack: Version 1 exports FOO=bar. Version 2 references FOO and expects bar. Version 2 then exports FOO=baz. Version 3 then references FOO=baz, and so forth.
As Luke said though, StackReference would be the only way that I can personally think of, though I’m not a Pulumi engineer, so they would know better. I wouldn’t think it would be designed to do this particular anyways, as I think the code is supposed to represent the state you want, and the state file represents the state you have. Therefore it’s not really ideal to try to reference the state you have from a previous version.
e

early-intern-90238

10/16/2019, 11:44 PM
Yeah I know its slightly out of intended path but I really wanted my nodes tagged with a version so that when I troubleshoot issues I know what version of my code they are running
w

white-balloon-205

10/16/2019, 11:50 PM
This is an interesting scenario - and may be a nice thing to expose as a general thing - like
pulumi.getStackVersion()
. There's some questions about exactly what this means - but we already do have a monotonically increasing "version" associated with stacks at least in the Pulumi service backend which could logically be exposed here. Mind opening an issue to track this use case? Definitely worth thinking more about.
e

early-intern-90238

10/17/2019, 2:26 AM
Yes absolutely, I thought the same thing when I was trying to do it as why I couldn't get that from the stack...