This message was deleted.
# general
s
This message was deleted.
s
That makes sense. I set
parent
of all of the resources to the component instance, but don’t set the component instantiation itself
b
It is supposed to pick up the global
Stack
component if you don't specify one, so you did the right thing here.
s
Ah, I see. Is there a way to set it explicitly in the meantime?
Having the visualization would be pretty nice for demoability
b
You can try:
Copy code
import { runtime } from "@pulumi/pulumi";

...

new SomeResource(..., { parent: runtime.getRootResource() });
This might work, depending on the nature of the bug. If the bug is that we're erasing the root resource (
Stack
) too soon, then this might lead to the same result.
Btw, do you have a repro program that I can link to in the bug?
s
Yes
I don’t have a minimal one right now but can make one if necessary
b
s
πŸ‘ The repro is not the easiest thing to run, because it relies on having a public hosted zone with the given domain name available
I suspect any component resource used at the top level would do this though?
b
I have a feeling this might be a problem if you end up with multiple copies of the
@pulumi/pulumi
module loaded. This can happen depending on how NPM decides to resolve semvers. One last thing you could do to help determine if this is the issue; can you run
find node_modules -name 'pulumi
from the root of your program, and let me know what it returns?
s
Copy code
~/Code/pulumi/pulumi-vault-test master*
❯ find node_modules -name 'pulumi'
node_modules/@pulumi/pulumi
However, some of the dependencies are installed via
npm link
, so it also has a copy of
@pulumi/pulumi
there
b
Ahh, does
find -L node_modules -name 'pulumi'
print multiple?
s
They are likely different versions too, since the module depends on the latest stable release, and I’m running something close to
master
Yes, following links shows 2, somewhat as expected:
Copy code
❯ find -L node_modules -name 'pulumi'
node_modules/@pulumi/pulumi
node_modules/@operator-error/pulumi-lambda-cert/node_modules/@pulumi/pulumi
b
Ah, ok, this must be it. Obviously this should work, but because each copy of the loaded module gets its own statics, what I think is happening is that the root resource gets created in one copy but not the other. Hence, the blank parent. cc @incalculable-sundown-82514
We will need to think about this one, I'll add notes to the bug.
s
Sounds good, thanks for confirming it’s a bug.
There was a second thread semi-concurrent with this one about values in a map not being tracked for pulumi update - not sure if you noticed that one too?
Also, FWIW, setting the parent to
runtime.getRootResource()
works great:
b
Awesome! Unfortunately, this means I don't actually understand the root cause as well as I thought, because that shouldn't have worked based on my theory πŸ™‚ Oh, well, glad you at least have a workaround for now!
s
Yes, this definitely solves the problem for now
πŸ‘ 1
@big-piano-35669 There is a weird side effect in the plan output of doing this though:
Copy code
Type                                           Name                                    Plan       Info
 +   pulumi:pulumi:Stack                            pulumi-vault-test-vault-test-dev        create.
 +   β”œβ”€ operator-error:aws:LambdaCert               algo-vault-lambda-cert                  create
 +   β”‚  β”œβ”€ aws:iam:Role                             algo-vault-lambda-cert-function-role    create
 +   β”‚  β”‚  └─ aws:iam:RolePolicy                    algo-vault-lambda-cert-function-policy  create
 +   pulumi:pulumi:Stack                            pulumi-vault-test-vault-test-dev        create..
 +   β”‚  β”œβ”€ aws:s3:Bucket                            algo-vault-lambda-cert-bucket           create
 +   β”‚  β”œβ”€ aws:lambda:Function                      algo-vault-lambda-cert-function         create
 +   β”‚  β”‚  └─ aws:lambda:Permission                 algo-vault-lambda-cert-permission       create
 +   pulumi:pulumi:Stack                            pulumi-vault-test-vault-test-dev        create
 +   β”‚     └─ aws:cloudwatch:EventTarget            algo-vault-lambda-cert-target           create
 +   β”œβ”€ operator-error:aws:Vpc                      algo-vault                              create
 +   β”‚  └─ aws:ec2:Vpc                              algo-vault-vpc                          create
 +   β”‚     β”œβ”€ aws:ec2:VpcDhcpOptions                algo-vault-dhcp-options                 create
 +   β”‚     β”‚  └─ aws:ec2:VpcDhcpOptionsAssociation  algo-vault-dhcp-options-assoc           create
 +   β”‚     β”œβ”€ aws:ec2:InternetGateway               algo-vault-igw                          create
 +   β”‚     β”œβ”€ aws:route53:Zone                      algo-vault-private-hosted-zone          create
 +   β”‚     β”œβ”€ aws:iam:Role                          algo-vault-flow-logs-role               create
(output is shortened, but you can likely see the repetition of the Stack in the output)