I'm not sure if this is the best channel for this,...
# python
d
I'm not sure if this is the best channel for this, but I have my Pulumi component library going alright, but for some reason I am seeing that when I try to set one component as the parent of another component, both components of which are created using the component library approach, the parent setting of a provided pulumi.ResourceOptions object seems to not actually make it to the child component's constructor. If I switch away from using the component libary and just import the underlying component directly with a Python library import, the parent parameter is totally fine and everything works. So I want to have something like this:
Copy code
Type                                     Name                                Plan       Info
 +   pulumi:pulumi:Stack                      core-infra.github-repos-apse2.prod  create     1 message
 +   └─ pp-github:index:Repository            devops-pulumi                       create     
 +      ├─ pp-github:index:RepositoryRuleset  devops-pulumi                       create     
 +      │  └─ github:index:RepositoryRuleset  devops-pulumi                       create     
 +      └─ github:index:Repository            devops-pulumi                       create     
 +         ├─ github:index:BranchDefault      devops-pulumi                       create     
 +         ├─ github:index:TeamRepository     devops-pulumi-developer             create     
 +         ├─ github:index:TeamRepository     devops-pulumi-team-leads            create     
 +         ├─ github:index:TeamRepository     devops-pulumi-bots                  create     
 +         └─ github:index:TeamRepository     devops-pulumi-devops                create
but end up with this instead, but only when using my library when installed as a package from Git through
pulumi package add
Copy code
Previewing update (apse2.prod):
     Type                                  Name                                Plan       Info
 +   pulumi:pulumi:Stack                   core-infra.github-repos-apse2.prod  create     1 message
 +   ├─ pp-github:index:Repository         devops-pulumi                       create     
 +   │  └─ github:index:Repository         devops-pulumi                       create     
 +   │     ├─ github:index:TeamRepository  devops-pulumi-bots                  create     
 +   │     ├─ github:index:TeamRepository  devops-pulumi-developer             create     
 +   │     ├─ github:index:TeamRepository  devops-pulumi-devops                create     
 +   │     ├─ github:index:TeamRepository  devops-pulumi-team-leads            create     
 +   │     └─ github:index:BranchDefault   devops-pulumi                       create     
 +   └─ pp-github:index:RepositoryRuleset  devops-pulumi                       create     
 +      └─ github:index:RepositoryRuleset  devops-pulumi                       create
I know that there the args gets sent to the component resource constructor as a dict, which I handle fine. The resources do get created correctly, I just want to have this hierarchy working properly. How do I go about debugging where things are going wrong here? It seems like the ResourceOptions object is built before I see it in the constructor object and I just see opts.parent set to None 😕
Just found by digging through GitHub issues the env var to dump RPC call contents, and I can see in there that the parent is correctly set there, so now I am even more confused as to why this isn't working properly
Managed to build a recreation of this issue and opened an issue on GitHub just in case: https://github.com/pulumi/pulumi/issues/20507