Can I set pulumi login path using Automation API? ...
# general
s
Can I set pulumi login path using Automation API? Right now doing it one time through CLI.
f
Yes, you can specify the backend as part of your workspace options.
đź‘Ť 1
s
@faint-table-42725 can we use etcd as a pulumi backend?
b
we have no support at this time for etcd as a backend - our backends are S3 / GCS / Azure / Local and S3 compatible backends
s
@faint-table-42725 @broad-dog-22463 are you talking about pass backend using workdir func of golang? Can you share a code snippet or a link to golang doc that I can use to pass backend path.
s
@faint-table-42725 I tried it. But when I set URL to S3 bucket it gives error “region not provided (something similar)”.
f
I would verify that manually running
pulumi login <url>
works for you via the command line
https://www.pulumi.com/docs/intro/concepts/state/#logging-into-the-aws-s3-backend has details on the correct configuration for the S3 backend
If it still doesn’t work, please file an issue with details on how you’re logging in
r
I tried it. But when I set URL to S3 bucket it gives error “region not provided (something similar)“.
Are you sure that error is from the login? Are you setting your region in your config for your aws program?
s
@red-match-15116 @faint-table-42725 yes I have. My code is very similar to the one in repo. I have defined the region exactly like this but the error is on backend url.
error: could not create stack: An IO error occurred while writing the new snapshot file: blob (key ".pulumi/stacks/dev.json") (code=Unknown): MissingRegion: could not find region configuration
@red-match-15116 @faint-table-42725 how s3 should be created? Like what policies or permissions should be there for s3 to work with pulumi?
@red-match-15116 @faint-table-42725 any suggestions?
r
I’m not really sure, sorry. Have you followed all of the directions on the page that Lee Zen linked? https://www.pulumi.com/docs/intro/concepts/state/#logging-into-the-aws-s3-backend
You might have to pass the region as an env var on workspace creation. https://github.com/pulumi/automation-api-examples/blob/main/go/inline_secrets_provider/main.go#L104-L107
Copy code
envvars := auto.EnvVars(map[string]string{
    "PULUMI_CONFIG_PASSPHRASE": "password",
    "AWS_REGION": "us-west-2",
})
s
@red-match-15116 Thanks envvars worked. It turned out usually we pass all config after creating/selecting stack but in this case we have to pass this information before. But that’s strange, it should be mentioned in the docs.
r
JSYK you don’t always have to send the message to the channel since we’re replying in this thread and I get an alert when you
@
me - it can be distracting for other folks 🙂 Anyway, just to confirm, do you have your
AWS_REGION
env var set globally? Are you able to log in using s3 without the env var if you just use the CLI?
s
@red-match-15116 Okay. Kind of habit to always tick the box in my work slack. I won’t do that from now onwards. No I don’t have anything in env variables. I am setting region and everything using stack.config. So in this case, we have to pass it in env variables. Now S3 backend is working.
r
Yeah, the difference is that you need the region set specifically for the backend URL to even work which is why it needs to be set on workspace creation rather than on the stack after it exists. Anyway, glad you got it working!
âś… 1