This message was deleted.
s
This message was deleted.
b
your component resource should take in
ComponentResourceOptions
which has the parent property on it
w
@bored-oyster-3147, see updated post. I accidently posted to early 🙂
b
gotcha
so both of them have the stack as a parent?
w
yes
The example is simplified. A should have multiple children and so should B. All the childrens on the same level as B are connected to the stack instead of A.
b
do all of B's children at least belong to B? And do all of A's children that are not also `ComponentResource`s correctly belong to A?
w
all childre of A are ComponentResources
I can throw in another just to check 🙂
Added
Copy code
new random.RandomUuid(name+"deleteme", undefined, {parent: this});
in the constructor of A, and that worked as expected. So something wrong with
ComponentResource
?
b
I'm looking at the SDK code and there is nothing that looks like parents work any differently, so I'm thinking maybe it is just the graphing that is treating ComponentResources different
ComponentResourceOptions
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 identically
how are you figuring out what the actual parent is? does the state file say the `ResourceB`'s parent is the stack or
ResourceA
?
w
Will check state file tomorrow. I checked the graph in the UI.
l
Are you passing
parent: this
as the args parameter of ResourceB? It needs to be in the opts parameter.
w
@bored-oyster-3147, checked the stack export now, and ResourceB has the stack as parent and not ResourceA.
@little-cartoon-10569, I call it as in the example in the post. There you see I call I have the parent set when initiating ResourceB from the constructor of ResourceA.
b
Something weird or something im unaware of going on then. I'd open an issue so pulumi guys get eyes on it
w
I might actually be in to something.
I was calling
super
wrong. The third argument is the args, and that is where I tried to pass in the options. Changing to
Copy code
super("....", name", undefined, options);
in ResourceB fixed it.
b
haha damn sorry i didn't notice that. glad you did and that it is working
it's those damn weakly typed languages! shakes fist
w
thanks for rubber ducking though 😆 . I agree on the language part. I did use F# first, but the SDK lends it better for C# or typescript as it is now IMO.
b
I'm almost exclusively a C# dev, but I would really like to learn F# more. The functional landscape is still a bit foreign to me but I think pulumi would lend itself well to it
w
That's what I think as well, but the SDK is more geared towards C#. I do however have a some pulumi F# in the wild. When you've created your helper functions you can get a pretty sweet DSL. Then there is this project as well which is super interesting: https://github.com/UnoSD/Pulumi.FSharp.Extensions
b
The TS implementation does have a bit of an easier time with pulumi, mostly because of all the union typing and it relies heavily on function serialization for dynamic providers and I would cringe into oblivion if I saw an implementation attempt that in C#
That is pretty cool though I'll check it out! though I am a bit trepidatious because the resource declarations start to look more like terraform again lol
w
Might be, but they are strongly typed and you should get some help in the IDE if it has F# support.
243 Views