This message was deleted.
s
This message was deleted.
e
stored into its own state file in AWS S3.
Might make things tricky, if your using different S3 buckets for the different stacks as that's currently seen as different backends and that's not currently supported https://github.com/pulumi/pulumi/issues/3395
b
Also, the idea is that once the VPC module has already been run (and produced the stack), I don’t need to run that anymore unless there’s a change to it. My new modules should just be able to load the VPC stack/metadata when I have to provision, let’s say an EC2, or RDS, for example.
The S3 bucket is common/shared, but each module will have their own stacks inside it, and managed separately.
e
StackReferences should work for you then
👍 1
b
Thanks, @helpful-vegetable-35581!
b
FYI you need to make sure that you are providing the same directory within that S3 bucket as a backend path. Different directories are treated as separate backends and you won't be able to stack reference across them, even if they reside in the same bucket
b
I see. I have to change the directory structure, then.
I’m getting the error below right after this code executes:
Copy code
stackRef, err := pulumi.NewStackReference(ctx, "poc-vpc-vpc1-dev-iad", nil)
Diagnostics: pulumipulumiStack (ec2_v1_alpha1-poc-ec2-okaytodelete-dev-iad): error: an unhandled error occurred: waiting for RPCs: Invoke(pulumipulumigetResource, ...): error: rpc error: code = Unknown desc = invocation of pulumipulumigetResource returned an error: unknown resource urnpulumipoc-vpc-vpc1-dev-iad:vpc v1 alpha1awsec2/subnetSubnet:poc-vpc1-dev-iad-pub2-subnet It’s able to locate the other stack that my EC2 stack depends on, but it’s complaining about something.
Can anybody help? I’m somewhat stuck on this approach. I also already searched for this same issue here in the community, but I didn’t find a solution.
b
Unfortunately I'm not sure what this error is so I was hoping someone else would chime in.
e
pulumi:pulumi:getResource
doesn't look like a stack reference, that's from a
pulumi.getResource
call
b
@helpful-vegetable-35581, can you clarify? I don’t have any getResource call other than pulumi.NewStackReference(ctx, “poc-vpc-vpc1-dev-iad”, nil). My hunch is that it’s from a downstream call. Is there anything I’m doing wrong?
e
Is there anything I’m doing wrong? (
Not sure. Just that "invocation of pulumipulumigetResource returned an error" is from a getResource call, not a registerStackReference call but that URN (urnpulumipoc-vpc-vpc1-dev-iad:vpc v1 alpha1awsec2/subnetSubnet:poc-vpc1-dev-iad-pub2-subnet) looks like its trying to load a resource from the stack listed in the stack reference, but getResource doesn't work like that it can only return resources in the current stack. I'd try and see where that stackreference gets passed to, and see if that code is trying to make a getResource call.
b
Hi, @helpful-vegetable-35581, I upgraded my Pulumi version from 3.21 to 3.29 and the error I reported has gone away.
🙌 1