bumpy-summer-9075
07/08/2021, 7:41 PMexport class MyResource extends pulumi.dynamic.Resource {
public readonly myStringOutput!: pulumi.Output<string>;
public readonly myNumberOutput!: pulumi.Output<number>;
constructor(name: string, props: MyResourceInputs, opts?: pulumi.CustomResourceOptions) {
super(myprovider, name, { myStringOutput: undefined, myNumberOutput: undefined, ...props }, opts);
}
}
from my own experimentation, it would seem that passing myStringOutput: undefined
to super
is how the property this.myStringOutput
is populated... I'm really weirded out by this, they are not the same variable/reference and there's very little documentation on it. How are they "linked" together?bored-oyster-3147
07/08/2021, 8:37 PMpulumi.dynamic.Resource
immediately passes those props to the pulumi.CustomResource
constructor which extends and passes them to pulumi.Resource
. So it doesn't appear to be anywhere in the core NodeJS SDK.
Maybe it is something here ? This looks to be the code where your dynamic provider is actually retrieved and invoked during pulumi execution. But if we look at where the create function happens we see:
1. props are retrieved, which is what contains the expansion of undefined output properties
2. provider is retrieved
3. create is invoked with the props that were provided to the resource. Result is received from provider (which isn't doing anything special with those undefined props because it's just an interface that is consumer implemented)
4. the resultIncludingProvider(...)
function does some object expansion to add the provider property to the result object for some reason?
5. and then we set the RPC response and return. Maybe structproto.Struct.fromJavascript(....)
is doing something weird cause it is being passed the extended result object? But If I understand what resultIncludingProvider(...)
is doing than we would've lost those undefined properties after calling that function
Can't figure it out 🤷♂️bumpy-summer-9075
07/08/2021, 9:16 PMresp.setProperties(structproto.Struct.fromJavaScript(resultProps));
since resultProps
contains both thebored-oyster-3147
07/08/2021, 9:26 PMbumpy-summer-9075
07/08/2021, 9:44 PM