https://pulumi.com logo
Title
s

stocky-jelly-20386

02/01/2023, 12:05 AM
how do I get the "aws:region" config in Golang? do I load the "config" object and then read "aws:region"?
m

miniature-musician-31262

02/01/2023, 12:07 AM
Like this:
providerConfig := config.New(ctx, "aws")
location := providerConfig.Get("region")
s

stocky-jelly-20386

02/01/2023, 12:08 AM
thank you
m

miniature-musician-31262

02/01/2023, 12:08 AM
You bet!
We could definitely make this clearer in the docs!
s

stocky-jelly-20386

02/01/2023, 12:11 AM
Yeah, I did look around and couldn't find anything
my search foo is not that good thoough
m

miniature-musician-31262

02/01/2023, 12:11 AM
Gets asked a lot, and I thought it was in there, but not obvious
Thanks for calling it out
Would love your thoughts on this change to the config docs — do you think this would’ve answered your question? https://github.com/pulumi/pulumi-hugo/pull/2456
s

salmon-account-74572

02/01/2023, 4:05 PM
It’s also worth noting that in Go (I don’t think it works for other languages, however) that this also works (I’m currently using it in a number of my Pulumi programs):
awsRegion := config.Require(ctx, "aws:region")
m

miniature-musician-31262

02/01/2023, 6:16 PM
This also works for YAML, but yeah, I’m not sure how “standard” it is across other languages.