Prior to using the automation API, I was using the...
# golang
f
Prior to using the automation API, I was using the config package (https://www.pulumi.com/docs/intro/concepts/config/) in Go to ingest config. And then a
pulumi up
would do the trick. I did not add any code to set the config. Now with the automation API all I see in the examples is
Copy code
// set stack configuration specifying the AWS region to deploy
	s.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: "us-west-2"})
Is there a way to consume config using a
Pulumi.dev.yaml
file? instead of setting one config at a time. Pulumi.dev.yaml
Copy code
config:
  aws:region: us-east-2
  aws:profile: sandbox
  aep:config:
    bucket:
      name: dinesh-test
l
Your
Pulumi.dev.yaml
file will be automatically read when
dev
is your active stack. The calls you see in the code are configuration settings which will be overlayed on top of what is in the file. This gives you the option to have some values committed to source control and to add (or overwrite) some values which come from somewhere else.
f
@limited-rainbow-51650 I am using the inline way of automation API and upon printing context, I see that the config is nil -
Config:map[string]string(nil)
. That makes me believe
<http://Pulumi.dev|Pulumi.dev>.yaml
is not being read as a part of the context. Is the behavior you are talking about different from normal Pulumi programs than automation API programs?
p
We have an external configuration file & describes how we want to our pulumi code to construct the instructions & we fetch the name via EnvVar & then read the file in using viper (or similar). We do this in the main function before we call pulumi.Run() ``````