I used the (*pulumi.Context).Export() function to ...
# golang
I used the (*pulumi.Context).Export() function to export a pulumi.StringArray of subnet IDs, and a few other metadata. At the bottom is an excerpt of my stack output as stored in my state file, which I’m already able to load using pulumi.NewStackReference(), and read a plain string like the “eip-1”, for example. My code for reading the eip-1 (which works) is:
Copy code
nsr, _ := pulumi.NewStackReference(ctx, vpcStackRef, nil)
eip1 := nsr.GetStringOutput(pulumi.String("eip-1"))
Now what I can’t figure out is how to read “data-subnets” into a slice. Can anybody help?
Copy code
"resources": [
                    "urn": "urn:pulumi:dev::vpc::pulumi:pulumi:Stack::dev",
                    "custom": false,
                    "type": "pulumi:pulumi:Stack",
                    "outputs": {
                        "data-subnets": [
                        "eip-1": "eipalloc-abcdcfa5cf063576d"
You can use
which will return any
. If you
that you can get the
value inside and I think it should be castable to a string slice.
🙌 1
@echoing-dinner-19531, I was looking for a canned function, but there appears to be none. Anyway, I’ve tried it with the ApplyT, and got it to work. Thanks!.