Is it possible to export stack outputs from within...
# general
b
Is it possible to export stack outputs from within an apply? Or return multiple outputs that all get exported after? I have go code similar to below and I'd like some outputs of the nodes that were created but don't know the number. The code has side effects I think and is unstable (i.e. concurrent map writes). I think I'd have to return a single value from a single node as the return value of apply and then export that. But how would I do it so it varies by dynamic number of nodes?
Copy code
component.Cluster.Nodes.ApplyT(func(nodes []pgedge.ClusterNode) string {
		for index, node := range nodes {
			name = fmt.Sprintf("node-%d", index+1)
			ctx.Export(name+"-name", pulumi.String(node.Name))
			ctx.Export(name+"-region", pulumi.String(node.Region))
			ctx.Export(name+"-zone", pulumi.String(node.AvailabilityZone))
		}

		return ""
	})