Is there anyway during pulumi preview to get the g...
# python
p
Is there anyway during pulumi preview to get the generic type T of the pulumi.Output object? ie if something is defined as being a
pulumi.Output[str]
is there anyway to check the type at runtime of
<pulumi.output.Output object at 0x7d5389558400>
?
The reason why I need this is because we use pulumi to pass variables to Nomad and unfortunately
<pulumi.output.Output object at 0x7d5389558400>
is not a str and we get runtime type errors during pulumi preview.
The potential workarounds are 1. skip pulumi preview, and forget about the safety guarantees 2. Write a hcl2 parser and use reflection to mock out the actual types during pulumi preview 3. Split the pulumi projects and chain them. This requires making changes into a 2 PR process
b
@polite-mechanic-60124 you need to it inside an apply
p
Even in a pulumi preview?
From https://www.pulumi.com/docs/intro/concepts/inputs-outputs/
Copy code
During some program executions, apply doesn't run. For example, it won't run during a preview, when resource output values may be unknown. Therefore, you should avoid side-effects within the callbacks. For this reason, you should not allocate new resources inside of your callbacks either, as it could lead to pulumi preview being wrong.
Unless something has changed, apply doesn't run during pulumi preview, so its not applicable
b
Sorry, I was focusing more on your need to interpolate the type T, not the preview par. You can't get the raw type T outside an apply
p
Ok, thank you. I thought it was a long shot.
b
It's definitely possible to do what you're trying to do though, if you could explain why the ultimate goal is I can help with that