https://pulumi.com logo
#general
Title
# general
b

bitter-island-28909

08/06/2019, 5:10 PM
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

white-balloon-205

08/06/2019, 5:11 PM
The behaviour here is a little strange - but is documented here: https://www.pulumi.com/docs/reference/programming-model/#dynamic-resource-outputs
b

bitter-island-28909

08/06/2019, 5:12 PM
ok, so I just need to define the interface and use type annotations?
w

white-balloon-205

08/06/2019, 5:16 PM
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

bitter-island-28909

08/06/2019, 5:18 PM
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

white-balloon-205

08/06/2019, 5:21 PM
Yep - definitely need to fix up that section. Glad it's working though!