https://pulumi.com logo
Title
a

ancient-eve-13947

08/17/2021, 5:57 PM
my typescript-fu is weak ūüė≥ how would I map
azure.types.input.web.NameValuePairArgs[]
to
pulumi.Input<{
        
[key: string]: pulumi.Input<string>;
    
}>
?
l

little-cartoon-10569

08/17/2021, 10:02 PM
You can use
pulumi.output("value")
to turn it into a
pulumi.Input<string>
. You'd have to loop over your array and construct your dict using
pulumi.output
, then after the loop wrap the entire dict in
pulumi.output
.
To create an object compatible with
{ [key: string]: pulumi.Input<string> }
you should be able to start with an
any
. Something like
var dict: any = {}
. Then when adding values, use the array-style notation
dict["newvar"] = pulumi.output("newval");
Once you've got it working, you could figure out the correct stronger-type for the
any
, but I'm not sure it'd be worth it...
Note that you might not need to wrap things in
pulumi.output()
, since
pulumi.Input<string>
is a union type of both
string
and
pulumi.Output<string>
. However I have found that working with
pulumi.output()
when solving this sort of issue helps me remember which bits are which. You may be able to remove
pulumi.output()
once you've got things working and strengthened your typescript-fu ;)
a

ancient-eve-13947

08/18/2021, 10:37 AM
see my next question, the problem is really with the index call.