I am looking to understand Stack References; in pa...
# google-cloud
I am looking to understand Stack References; in particular, ones where the Stack Reference is on a different Google Storage bucket than the stack being used. Scenario: • Stack Account - configures an private artifact registry with charts, docker images, etc, along with a secret key Output. Hosted in, say, gs://bucket/account/ • Stack B - brings up a kubernetes cluster, networking, etc. Hosted in, say, gs://otherbucket/b/. • Problem: In Stack B's code, I want to reference Stack A to bring down the secret key and allow pulling from Stack A's output. Result (go SDK):
pulumi:pulumi:StackReference (<gs://bucket/account>):
error: Preview failed: unknown stack "account"
stack references dont work across buckets, you need to store state in the same bucket
I was terribly afraid of that. Do you offhand know if there are plans to change that? Because we're having a lot of different stacks and projects, sharing "deeper" refs would be nice.
There aren’t any plans to change that I don’t think, I’m not even sure how it would work
Query: what about different stacks from different projects in the same bucket?
yes that’s totally possible, it’s in the stack ref api
Hmmmm. I moved the stack state to
, but I'm still getting identical errors. Verbosity doesn't seem to help debug the matter either. I'm not sure how to trace the error beyond the "unknown stack" bit.
Copy code
stack, err := pulumi.NewStackReference(ctx,
				Name: pulumi.String("account"),
what is your stack name? are you storing things in different directories? ie
pulumi login <gs://bucket/integration>
pulumi login <gs://bucket/foo>
. if so, that won’t work
so we don't use
, we specify the URL in Pulumi.yaml. And yes, these are different directories.
these are different proejcts.
trying to read output from one project's stack into another project's stack.
you need to use the same URL for all projects, and name your stack something like
That ship sailed over a year ago......... sorry. There's no other solution?
project support in self managed backends is due to be shipped soon: https://github.com/pulumi/pulumi/issues/2522#issuecomment-1426496284
There’s no other solution?
Nope, if you don’t store state in the same place you won’t be able to use stack references
that's.... super frustrating. Anyway. Thanks for the canonical answer.