https://pulumi.com logo
Title
m

mammoth-honey-6147

10/15/2021, 4:15 PM
is there a way to type/cast a
stack output
object? In one stack I export a
pulumi.StringArray{}
, when I reference this in another stack it returns type
pulumi.AnyOutput
. I want to iterate over this like an array, but currently the only way I've got round to do this is via reflection, ie:
output1 := stackReference.GetOutput(pulumi.String("Infra"))
		
		_ = output1.ApplyT(func(list interface{}) string {

			switch reflect.TypeOf(list).Kind() {

			case reflect.Slice:
				s := reflect.ValueOf(list)

				for i := 0; i < s.Len(); i++ {
b

billowy-army-68599

10/15/2021, 4:48 PM
unfortunately no, this is the best way at the moment 😞. generics will help us here
m

mammoth-honey-6147

10/15/2021, 4:50 PM
Thanks for confirming @billowy-army-68599 🙂