Thread
#general
    b

    brave-lizard-56518

    4 months ago
    Is there a way to retrieve the raw “outputs” of the NewStackReference(), so I can deserialize it into JSON?
    b

    billowy-army-68599

    4 months ago
    do it inside an
    apply
    b

    brave-lizard-56518

    4 months ago
    @billowy-army-68599 — I’d like to retrieve the entire “outputs” — do I use the pulumi.Outputs element for that?
    b

    billowy-army-68599

    4 months ago
    can you show me what you're trying to do with some code?
    b

    brave-lizard-56518

    4 months ago
    @User — here’s an example excerpt of my stackOutput as stored in S3:
    "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
                    },
    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

    billowy-army-68599

    4 months ago
    you cannot resolve an output into JSON because its resolved eventually, it has to be done inside an apply