Is there a way to retrieve the raw “outputs” of th...
# general
b
Is there a way to retrieve the raw “outputs” of the NewStackReference(), so I can deserialize it into JSON?
b
do it inside an
apply
b
@billowy-army-68599 — I’d like to retrieve the entire “outputs” — do I use the pulumi.Outputs element for that?
b
can you show me what you're trying to do with some code?
b
@User — here’s an example excerpt of my stackOutput as stored in S3:
Copy code
"resources": [
                {
                    "urn": "urn:pulumi:abc::def::pulumi:pulumi:Stack::ghi",
                    "custom": false,
                    "type": "pulumi:pulumi:Stack",
                    "outputs": {
                        "private-subnet-ids": [
                            "subnet-12345",
                            "subnet-23456",
                            "subnet-34567"
                        ],
                        "public-subnet-ids": [
                            "subnet-abc",
                            "subnet-def",
                            "subnet-ghi"
                        ],
                        "vpc-id": "vpc-12345"
                    },
                    "sequenceNumber": 1
                },
Copy code
type VpcOutputs struct {
	PublicSubnetIds          []string `json:"public-subnet-ids"`
	PrivateSubnetIds         []string `json:"private-subnet-ids"`
	VpcID                    string   `json:"vpc-id"`
}

func somefunc(vpcStackRef string) {
	nsr, _ := pulumi.NewStackReference(ctx, vpcStackRef, nil)
	if err != nil {
		return vso, nil, err
	}

	// I need the raw "outputs", but don't know whether pulumi can give me that.
	outputs := nsr.Outputs
	var stackOutput VpcOutputs
	json.NewDecoder(outputs).Decode(&stackOutput)

}
b
you cannot resolve an output into JSON because its resolved eventually, it has to be done inside an apply