https://pulumi.com logo
#golang
Title
# golang
s

sticky-bear-14421

04/12/2021, 7:33 AM
Good morning, Im having trouble parsing an item from the config:
pulumi config set adminRole "foobar"
My code has a string variable defined I will load the value into ..
var adminRole string
conf := config.New(ctx, "")
conf.RequireObject("adminRole", &adminRole)
But, running pulumi up fails with an error I fail to understand:
panic: fatal: A failure has occurred: unable to unmarshall required configuration variable 'my_project:adminRole'; invalid character 'o' in literal false (expecting 'a')
I tried with various versions of "foobar" or foobar without the quotes
Interesting is the code points to the 'o' and not f .. I even tried setting "false" and then the code complains about false being boolean and my target go type is a string
Not so "fun fact", when I change my code from config.RequireObject to foo := config.Require it works ..
l

lemon-agent-27707

04/12/2021, 7:35 PM
That sounds odd. Would you mind opening a bug with a repro.
config.require
does return a string.
requireObject
will read the string value and attempt to unmarshal it into the provided interface (a string in your case). I image that you probably want
require
in this case
👍 1
s

sticky-bear-14421

04/13/2021, 7:16 AM
Will open a bug report
3 Views