refined-printer-32244
11/13/2022, 11:23 PMOutput
values to concrete values. everything I find online seems to call methods that don't exist for me or don't seem to work as the stuff I find online says. currently, I have an output named projectName
on one stack, and I use a stack reference to get that value from from the other stack as a pulumi.AnyOutput
and then use that with .AsStringOutput()
to give me a pulumi.StringOutput
(it's a string, this seems to work fine). however, i'm trying to take that value and pass it into a digitalocean.LookupProject
where the Name
arg expects *string
. I've tried a bunch of iterations, including ApplyT
with a func(projName string) *string
, but I just can't seem to get the value the lookup expects. I'm also having a hard time taking pulumi.StringOutput
to string
at times as well. it sounds like it's supposed to be ApplyT
, but that just returns an output that gets me back into the same pulumi.StringOutput
. anyone have some tips for me?little-cartoon-10569
11/13/2022, 11:25 PMApplyT()
.refined-printer-32244
11/13/2022, 11:34 PMstring
from a pulumi.StringOutput
string
https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi#StringOutput, and the inner *OutputState
only seems to include ApplyT
, which just returns another pulumi.Output
.little-cartoon-10569
11/13/2022, 11:45 PMrefined-printer-32244
11/13/2022, 11:49 PMlittle-cartoon-10569
11/13/2022, 11:50 PMrefined-printer-32244
11/13/2022, 11:51 PMlittle-cartoon-10569
11/13/2022, 11:51 PMrefined-printer-32244
11/13/2022, 11:55 PMName
, which requires a *string
.digitalocean.LookupProjectOutput
which will accept and return input/output typeslittle-cartoon-10569
11/14/2022, 12:07 AMrefined-printer-32244
11/14/2022, 12:08 AMlittle-cartoon-10569
11/14/2022, 12:09 AMrefined-printer-32244
11/14/2022, 12:09 AMApplyT
on there it'll complain that it can't assign pulumi.StringOutput
or pulumi.StringPtrOutput
(I tried both) to a *string
little-cartoon-10569
11/14/2022, 12:13 AMName
should be an Input, and projName
is an Output. I guess my golang is not up to this problem.. I should stick with typescript...refined-printer-32244
11/14/2022, 12:15 AMpulumi.Output
values, but those are subdivided into pulumi.StringOutput
, etc. and then if I try to convert a pulumi.StringOutput
to a string
by just doing something like var myString string = myStringOutput
it sounds like that should work, but it doesn'tlittle-cartoon-10569
11/14/2022, 12:33 AMrefined-printer-32244
11/14/2022, 12:38 AMstring
billowy-army-68599
11/14/2022, 1:38 AMjust doing something likeyeah that unfortunately won’t ever work. You can’t assign anit sounds like that should work, but it doesn’tvar myString string = myStringOutput
StringOutput
to a string
unless you are inside the ApplyT
.
so as an example:
// here myOutputValue is always an output
myOutputValueApplyT(func(myOutput string) string {
// here, we are inside the ApplyT function, so we have resolved the value and now it's a string
fmt.Println(myOutput)
}