I have a question about StackReferences and type c...
# golang
I have a question about StackReferences and type conversions in Go. I have an array of AWS subnet IDs that I am exporting (via
ctx.Export("subnetIds", pulumi.StringArray("subnets"))
in one stack. In another stack, I'd like to use a StackReference to pull that data out, but I'd like for it to just be a plain, ordinary array of strings so that I can iterate over it. Is there any way to do that?
What are you trying to do with them? Apply is always an option. Also, Automation API allows you to access stack references synchronously.
Hey Evan! The code I got from you a while back (which involves the use of
) still generates an array of type
, which can't be iterated over. The ultimate end goal is to use these values either in some
Transformations or to write them into a YAML file.
@salmon-account-74572 if you will use the automation API you could access the outputs of one stack and transform them to strings / array whatever:
Copy code
outputs, _ := stack.Outputs(ctx)
val, ok := outputs["someExportVar"]
if !ok {
	return nil, errors.New("previous stack didn't output 'someExportVar' value")
v := val.Value.(string)