https://pulumi.com logo
Title
b

better-pencil-34948

02/24/2023, 5:34 PM
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"
b

billowy-army-68599

02/24/2023, 5:41 PM
stack references dont work across buckets, you need to store state in the same bucket
b

better-pencil-34948

02/24/2023, 5:42 PM
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.
b

billowy-army-68599

02/24/2023, 5:46 PM
There aren’t any plans to change that I don’t think, I’m not even sure how it would work
b

better-pencil-34948

02/24/2023, 10:23 PM
Query: what about different stacks from different projects in the same bucket?
b

billowy-army-68599

02/24/2023, 10:24 PM
yes that’s totally possible, it’s in the stack ref api
b

better-pencil-34948

02/24/2023, 10:34 PM
Hmmmm. I moved the stack state to
bucket
, 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.
stack, err := pulumi.NewStackReference(ctx,
			"<gs://bucket/integration/>",
			&pulumi.StackReferenceArgs{
				Name: pulumi.String("account"),
			},
		)
b

billowy-army-68599

02/24/2023, 10:37 PM
what is your stack name? are you storing things in different directories? ie
pulumi login <gs://bucket/integration>
and
pulumi login <gs://bucket/foo>
. if so, that won’t work
b

better-pencil-34948

02/24/2023, 10:37 PM
so we don't use
login
, 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.
b

billowy-army-68599

02/24/2023, 10:39 PM
you need to use the same URL for all projects, and name your stack something like
<http://integration.dev|integration.dev>
b

better-pencil-34948

02/24/2023, 10:40 PM
That ship sailed over a year ago......... sorry. There's no other solution?
b

billowy-army-68599

02/24/2023, 10:41 PM
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
b

better-pencil-34948

02/24/2023, 10:42 PM
that's.... super frustrating. Anyway. Thanks for the canonical answer.