This message was deleted.
# getting-started
s
This message was deleted.
m
Happy to move this post over to #CCWP5TJ5U instead if it’s a better candidate for that channel
e
Sanity check you can add
fmt.Println("ENV:", os.Getenv("PULUMI_CONFIG"))
to check the program config looks right. Should be a JSON object with all your values in it.
m
Thanks for the tip — the config does seem to be correct
e
#CCWP5TJ5U might see the issue but the code looks alright to me. If you don't have any luck feel free to open an issue at our github and we can take a closer look.
👍 1
m
Here’s a much simpler case of the error to reproduce. Stack:
Copy code
config:
  gcp-go-gke:data:
    cluster:
      name: my-cluster
  gcp:project: my-proj
  gcp:zone: us-west1-a
`main.go`:
Copy code
type Data struct {
	cluster Cluster
}

type Cluster struct {
	name string
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {

		var d Data
		cfg := config.New(ctx, "")
		cfg.RequireObject("data", &d)

		fmt.Println("Cluster name is:", d.cluster.name)

		return nil
	})
}
And
d.cluster.name
here is
""
Does Pulumi support ingesting structured config if the some of the fields themselves are user-defined go structs? Seems that’s the primary difference between the use-case here and the provided example
Think I figured it out. The issue is that my struct fields are private (lower-case), but need to be upper-case so
RequireObject
can properly populate the passed in struct.
e
Ah yes, its just using the standard go json marshalling logic underneath. Surprisingly that constraint isn't pointed out in the docs.