bored-table-20691
05/24/2021, 8:29 PMint
/ IntOutput
value from a stack reference. Specifically, in one stack I did a ctx.Export("db-port", <http://pulumi.Int|pulumi.Int>(5432)
, and then in another stack I had a reference to it. Since there isn’t a GetIntOutput
option, I ended up having to do it manually with ApplyT
, and then found out that the value comes across as a float64
(I’m assuming due to the JSON encoding). I ended up with this utility function:
func getIntOutput(ref *pulumi.StackReference, key string) pulumi.IntOutput {
output := ref.GetOutput(pulumi.String(key))
return output.ApplyT(func(port interface{}) int {
return int(port.(float64))
}).(pulumi.IntOutput)
}
I wanted to see if this was expected and also if the above solution is reasonable.billowy-army-68599
05/24/2021, 8:31 PMbored-table-20691
05/24/2021, 8:31 PM