I noticed some awkwardness in getting an `int` / `...
# golang
b
I noticed some awkwardness in getting an
int
/
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:
Copy code
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.
b
this looks like a bug, can you file an issue for it?
b
Will do.
let me know if I can clarify anything - I just reproduced this to verify the error messages