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

square-coat-62279

11/30/2021, 10:55 AM
hi everyone, I have a use case in which I need to parse a string array to create k8s secret, however the array is dynamic, i.e. depending on some condition, it may contain a predefined list or it may need to join the predefined list with another dynamic list which is pulumi.Output<string []>. I keep getting Output string[] is not compatible with string [] due to missing operator such as push etc. Is there anything that I can "marry" these 2 data types?
p

prehistoric-activity-61023

11/30/2021, 10:57 AM
from what I understand, you probably want to use methods like
.apply
that are available in
pulumi.Output
objects
if you need to modify the Pulumi Output, you cannot directly operate on it (as you said,
Output<string[]>
is not
string[]
)
however, you can transform it within function passed to
apply
method
l

little-cartoon-10569

11/30/2021, 8:07 PM
This joins an Outout<string[]> to a string[]:
Copy code
outputStringArray = outputStringArray.apply(oa => oa.concat(stringArray));
s

square-coat-62279

12/15/2021, 1:37 PM
thanks @little-cartoon-10569
👍 1
2 Views