This message was deleted.
# general
s
This message was deleted.
w
You can access the underlying value from within an
.Apply()
callback. More on this at https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs. Also in this video (though focused on Node.js):

https://www.youtube.com/watch?v=lybOxul2otM

If you have a snippet of what you are trying, might be able to suggest a specific solution.
a
Hi @white-balloon-205, I'm calling https://github.com/pulumi/pulumi-packet/blob/6f22a18281cc0958f7fb6111de62028504dc42a8/sdk/go/packet/spotMarketRequest.go#L68 and need to use the
ID()
in the call to
LookupSpotMarketRequest
by passing a
RequestId
(https://github.com/pulumi/pulumi-packet/blob/6f22a18281cc0958f7fb6111de62028504dc42a8/sdk/go/packet/getSpotMarketRequest.go#L23) which is a
string
(should it be a
StringInput
?) which is why I need to grab the
string
value from
x.ID()
w
Got it - you should be able to just use
.ToStringOutput()
on the id.
Ahh - no - I see the second part. You then need to call
LookupSpotMarketRequest
inside an
Apply
, since you cannot call that until the underlying ID is available.
Here's a similar example:
Copy code
bucket, err := s3.NewBucket(ctx, "my-bucket", nil)
if err != nil {
	return err
}
hostedZoneId := bucket.ID().ApplyString(func(id pulumi.ID) (string, error) {
	res, err := s3.LookupBucket(ctx, &s3.LookupBucketArgs{Bucket: string(id)})
	if err != nil {
		return "", err
	}
	return res.HostedZoneId, nil
})
a
Great, thanks 👍 Will give a try later.