Hi, I've tried to read the docs, but couldn't unde...
# golang
m
Hi, I've tried to read the docs, but couldn't understand . How do i convert
pulumi.StringOutput
to
string
or
pulumi.String
? thanks !
b
To get to the underlying string you can use ApplyT which will also return a StringOutput. But more generally, what are you trying to achieve?
a
I found this quite confusing as well. My reason was basically I'm coming from Terraform and I'm accustomed to doing stuff like interpolating strings into IAM policies and it being extremely straightforward, since TF abstracts the hard work for you
m
@bored-table-20691 well, i've already found workaround. But the usecase was to create route53 entry for other created resources (like rds).
b
You’d typically use either ApplyT or pulumi.Sprintf - depending on how sophisticated the construction of the new value needs to be.
b
@many-agent-57485 @ambitious-salesmen-39356 if you're trying to wrap your head around why you can't manipulate these values without
ApplyT
- give this a read: https://www.leebriggs.co.uk/blog/2021/05/09/pulumi-apply.html
a
Good to know I'm not the only person who didn't find this obvious 😅
b
it's a very common question, and I struggled with it myself 🙂
a
Good article, that does indeed help. Thanks!
it's a concept I've always I guess inherently understood in terms of values only known after apply and their being used to construct the DAG, they're just not quite as straightforward to work with (at least in Go) relative to their tf equivalents, ie my point of reference
b
i totally hear you, we continue to try make this easier as time goes on
m
Coming from Terraform myself I also found
.Apply
difficult to wrap my head around. The aforementioned blog post from @billowy-army-68599 is awesome and after a while it makes sense, just took some practice