Q: How can I do a `pulumi login` (to Pulumi Cloud)...
# automation-api
l
Q: How can I do a
pulumi login
(to Pulumi Cloud) via the automation API? I have a use case where I sometimes am using Pulumi Cloud and sometimes S3, code in thread
I’m using the Go SDK, ProjectBackend
Copy code
import (
    ws "<http://github.com/pulumi/pulumi/sdk/v3/go/common/workspace|github.com/pulumi/pulumi/sdk/v3/go/common/workspace>"
)

proj, err := ws.LoadProject("./Pulumi.yaml"))
...
proj.Backend = &ws.ProjectBackend{
	URL: "???",
}
When I set the the backend URL to
s3://…
, that works. When I set the backend URL to empty string or don’t set it, Pulumi uses the backend currently logged in at the user level. In the specific case that I manually ran a
pulumi login
to Pulumi Cloud most recently on this machine, it works. I don’t consider this viable, since I will be executing in a variety of environments and have no control of the system Pulumi login state. When I set the backend URL to
<https://app.pulumi.com>
, I get the error
Copy code
error: getting user info from <https://app.pulumi.com>: unmarshalling response object: invalid character '\u003c' looking for beginning of value\n\n
Note that I am setting
PULUMI_ACCESS_TOKEN
, I have already tested that auth is not the issue. Judging from the code in the Pulumi CLI, there isn’t simply a URL I can pass in to indicate that I want to use Pulumi Cloud.
r
You'll want
<https://api.pulumi.com>
l
Thank you very much, that was exactly what I was looking for! Will have a doc improvement PR up shortly