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

steep-angle-29984

09/10/2020, 9:02 AM
I experienced unexpected behavior when accessing the name of a k8s.core.v1.Secret resource. I created a k8s.core.v1.Secret resource and wanted to read the name output: First try:
Copy code
secret.metdata.name.apply(applyFunc)
-> In this case the applyFunc is executed in preview phase and 'undefined' is passed as value Second try:
Copy code
secret.metdata.apply(applyFunc)
-> In this case the applyFunc is not executed in preview phase Does anyone know if the different behavior is intended?
g

green-school-95910

09/10/2020, 9:48 PM
The first one is known at preview phase, it gives you the name you have set, it might not be the same value as during deployment time, but there is a value there. The second one is not, you need all the metadata to have it passed to the apply function, so it is only available during deployment. This seems correct to me
s

steep-angle-29984

09/11/2020, 8:29 AM
Thanks, I didn't know that. To be clear, the first one will be called during preview with the value which is set on resource instantiation and if it isn't set, as in my case, it will still be called in preview but with 'undefined'?
g

green-school-95910

09/11/2020, 12:04 PM
Yeah, during preview if the resource is new the values that have a matching input may be called with the input value, which may be undefined
That is my interpretation. I have not looked into the code for the kubernetes plugin to check if this what it actually does. I know that gcp plugin does that for some similar cases
s

steep-angle-29984

09/11/2020, 12:11 PM
Ok, thank you.