Is there a way to turn `pulumi.Output*<*string[...
# general
Is there a way to turn
into a
There is actually no way to do this. The latter implies that the length of the array is known promptly, whereas the former in general the length of the array is only known some time in the future. So there is no way to turn the former into the latter (it contains strictly less information). The example you have below returns a
q: Output<Output<string>[]>
which is probably not what you want. If you can share the context of how you are trying to use this - there is frequently an alternative way to structure things that can avoid the need to know the length of the array promptly.
Yeah the example I provided returned the type you mentioned but it works, I assume pulumi just flattens it in the end. That being said, it works even without me doing anything with it. What I am doing is using zone.nameservers as an argument to records on
It expects
while I have
Can I assume in the future that they will work interchangeably or is this just a fluke?
Yeah I know of the types I was just not sure why
would work with something that expects
Notice the distinction, one is a promise of Array<String> the other is Array of Promises containing String.
input is of type
which accepts an
Note that there is an extra
on the outside. That is why.
Yeah but they are different types. Not referring to input/output because I am sure Pulumi tackles that. I am referring to the fact that one is an Array of Strings the other is an Array of Promises.
Yeah but as I said, it’s not clear what kind of type implicit conversion pulumi does there. I mean from a Type safety PoV An Array of Promises is significantly different than an Array of Strings
An input is a T or a Promise<T> or an Output<T>.
It’s just a union of these three types - any of them is allowed.
Right, but there is a distinction here, I am not sure if I am explaining it properly. You got something that expects
But I hand it an
They are different, but I am sure you tackle it somehow, but from a type safety point of view, I don’t think it’s sound.
I guess Pulumi just flattens until there is no more promises and takes the values.
I wasn’t sure if it was a fluke or not.
I mean it worked.
The key thing is the outer Input (and that there are two of them). There is no sense in which it expects a
. (Technically that is one valid thing it accepts, but it accepts many others including
. If you expand out both Inputs into each of the three options in the Union you get a total of 9 options, one of them is exactly the thing you have.
Just to restate - they type of the input here is
Alright, thanks for taking your time explaining it, appreciate it.
👍 1
Sorry to bother you again, is there a way I can get access to the value of a Input? Say I create a IAM user and want its access token and keys to add to a Kubernetes Secret/Volume. Pulumi makes it so easy to do that. The issue with regular k8 ( I am not using k8x) I can’t get access to the value.
We’re not going to use k8 crosswalk because we want to remain as close as we can with manifest files while still using typescript. It’s actually nicer for debugging/lookup purposes.
You should be able to pass an Input into a Kubernetes resource in Pulumi. Can you share an example of what you are trying?
So any Pulumi promise type (Input/Output) will be flatten to its T when applied to any kubernetes manifest spec?