Why we have to have pulumi.String then pulumi.Stri...
# getting-started
p
Why we have to have pulumi.String then pulumi.StringOutput, then pulimi.StringPtrOutput and how can I use one of those as normal old fashioned string?!?!?!?!?!?!
m
Hi there. The short answer is that an output is not a simple value like a plain string or number, it’s more like a promise, if you’re familiar with that concept. This can definitely be confusing at first, so if you haven’t read through the docs on this topic, I’d suggest taking some time to do that, as it can take a bit to digest: https://www.pulumi.com/docs/concepts/inputs-outputs/
p
yeh, yet even terraform uses simple types 😄 you push string but it comes out as some freak abomination.... well, it takes special type of.... effort to achieve that 😄
m
That said, I do find this to be a bit more cumbersome in Go than the other languages (presumably because of the pointers). Python, TypeScript, C# and Java don’t have this additional layer.
YAML likely operates more like the HCL you may be used to.
p
yeh... still if you make it work in pulumi, we won't have to make stupid workarounds in code.... I believe APIs return simple string, don't they? Anyway.... modern programming... hence whey ChatGPT is so popular 😄
even this stupid and ugly workaround isn't working:
Copy code
var region string

	_ = subnet.Region.ApplyT(func(name string) string {
		region = name

		return name
	})
you really have outdone yourselves 😄 great job 😄
m
👍
p
do you hire? I may need to come fix all the problems and leave 😄
b
if you can’t figure out how outputs work, you’re not gonna fix much
p
Just because you picked some 70s concept that somehow have found following in the convoluted mess Java is... doesn't mean we all don't know how to code 😄 So let me recap this for you: 1. The API you query returns string. 2. You know it is a string as you put it in a pulumi.StringOutput - it's in the name. 3. You cannot in any way put out the real string the API returned at any given time??!?!? Oh and there is a bonus: 4. Terraform module you use DO actually return string... no promises or futures there 😄 So, why on Earth you decided to use a concept for asynchronous programming in simple IaC happening and thus butcher the very fathers of IaC in their own game? If you cannot order the resources you ought to create in the correct sequence... well 😄 Still, no offence meant, just constructive feedback - keep it simple dudes. This ain't Java 😄
b
I didn’t write the implementation and i no longer work for Pulumi, so I don’t have to give you any grace.
The API you query returns string.
Yes, it returns a string. Well done. There is no issue with Pulumi not knowing it’s a string, and the fact you keep saying that shows how little you understand the problem and the space
You cannot in any way put out the real string the API returned at any given time
yes, you can. You just haven’t figured out how to do it because either A) you can’t read or B) you haven’t read the documentation properly and are just resorting to abusing this free community slack support in an attempt to try and prove your perceived superiority
Terraform module you use DO actually return string... no promises or futures there
Again, this is so fundamentally incorrect that it shows how much you lack understanding. If you’re going to start throwing around insutling accusations, at least try and understand the space you’re talking about instead of showing yourself up by being completely ignorant of how things work If you want to come back and not be a complete asshole there’s a few people in here who’d not only help you, but actually get you where you need to be.
m
Hi @billowy-army-68599 and @polite-needle-86030, Can we maintain a culture of constructive feedback and being respectful of differing opinions, viewpoints, and experiences. Many thanks.
p
Guys, my bad and I'm sorry if I've been mean or just rude!... yes this type thing is annoying, but could've been much better if someone mentioned pulumi.Sprintf() - Thank you! 😄
m
pulumi.Sprintf()
is my goto way when working with outputs in Golang
p
Yes, it has all anyone should need to tinker with variables and whatnot! GG pulumi!
q
i used
fmt.Sprintf("%s", resource)
, when resource is pulumi.StringInput. is safe to do that?