wet-noon-14291
03/19/2021, 11:20 PMResourceB extends pulumi.ComponentResource {
constructor(name: string, options: pulumi.ComponentResourceOptions) {
super("....", name, options);
}
}
ResourceA extends pulumi.ComponentResource {
constructor(name: string) {
super("....", name, {});
new ResourceB(name, { parent: this });
}
}
With this code I would expect to get the following resource graph:
(stack) -> A -> B
instead I get
(stack) -> A
\-> B
What do I do wrong? How do I get the first graph?bored-oyster-3147
03/19/2021, 11:22 PMComponentResourceOptions
which has the parent property on itwet-noon-14291
03/19/2021, 11:24 PMbored-oyster-3147
03/19/2021, 11:24 PMwet-noon-14291
03/19/2021, 11:29 PMbored-oyster-3147
03/19/2021, 11:33 PMwet-noon-14291
03/19/2021, 11:34 PMnew random.RandomUuid(name+"deleteme", undefined, {parent: this});
in the constructor of A, and that worked as expected. So something wrong with ComponentResource
?bored-oyster-3147
03/19/2021, 11:42 PMComponentResourceOptions
extends ResourceOptions
and ComponentResource
extends Resource
so that options instance is just passed to the base Resource
as-is which means that parent property should be treated identicallyResourceA
?wet-noon-14291
03/20/2021, 12:29 AMlittle-cartoon-10569
03/20/2021, 2:58 AMparent: this
as the args parameter of ResourceB? It needs to be in the opts parameter.wet-noon-14291
03/20/2021, 9:25 PMbored-oyster-3147
03/20/2021, 9:27 PMwet-noon-14291
03/20/2021, 9:30 PMsuper
wrong. The third argument is the args, and that is where I tried to pass in the options. Changing to
super("....", name", undefined, options);
in ResourceB fixed it.bored-oyster-3147
03/20/2021, 9:35 PMwet-noon-14291
03/20/2021, 9:37 PMbored-oyster-3147
03/20/2021, 9:38 PMwet-noon-14291
03/20/2021, 9:40 PMbored-oyster-3147
03/20/2021, 9:41 PMwet-noon-14291
03/21/2021, 9:15 PM