Getting the output of a DynamicResource doesn’t se...
# general
b
Getting the output of a DynamicResource doesn’t seem to work as expected in dynamically typed javascript. I’m setting
myProperty
in the
outs
key of the return value of the provider’s
create
method, but calling
resource.myProperty
returns undefined. Inspecting the resource object itself, I don’t see any values pertaining to
myProperty.
w
The behaviour here is a little strange - but is documented here: https://www.pulumi.com/docs/reference/programming-model/#dynamic-resource-outputs
b
ok, so I just need to define the interface and use type annotations?
w
Not quite (and I actually see those docs are slightly confusingly phrased). The salient part are the `undefined`s in this:
Copy code
super(myprovider, name, { myStringOutput: undefined, myNumberOutput: unedfiend, ...props }, opts);
Any outputs you want to set on the resource object need to be passed as input properties (set to
undefined
) in the args bag.
b
gottit, will try that. Thank you!
@white-balloon-205 that works great, thanks a bunch! yes, I will say those docs are a bit confusing since they show all the interface and type hints which most people using JavaScript won’t be using typically. The important bits (setting the undefined values in the ctor) got lost in the noise. But it makes sense now!
w
Yep - definitely need to fix up that section. Glad it's working though!