great-arm-54759
04/30/2022, 3:26 PMfailed to create stack: exit status 255
code: 255
stdout:
stderr: Logging in using access token from PULUMI_ACCESS_TOKEN
error: getting user info from <http://localhost:4566/project-gaia>: [404] <?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>api/user</Key>
<RequestID>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestID>
</Error>
Ps: Using with pulumi new
, it worked well ~ ❯ pulumi login "<s3://project-gaia?endpoint=http://localhost:4566&disableSSL=true&s3ForcePathStyle=true>" ✘ INT 11:59:49
Logged in to xpto as romulofranca (<s3://project-gaia?endpoint=http://localhost:4566&disableSSL=true&s3ForcePathStyle=true>)
pulumi new
:billowy-army-68599
04/30/2022, 6:37 PMpulumi whoami
- you need to login to a backend firstgreat-arm-54759
04/30/2022, 8:20 PMLogged in to xpto as romulofranca (<s3://project-gaia?endpoint=http://localhost:4566&disableSSL=true&s3ForcePathStyle=true>)
func CreateHandler(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "application/json")
var createReq CreatePolicyReq
err := json.NewDecoder(req.Body).Decode(&createReq)
if err != nil {
w.WriteHeader(400)
fmt.Fprintf(w, "failed to parse create request")
return
}
ctx := context.Background()
stackName := createReq.Name
program := services.CreateStack("gaia-test-policy", "gaia-test-role")
opts := []auto.LocalWorkspaceOption{
auto.Project(workspace.Project{
Name: tokens.PackageName(stackName),
Runtime: workspace.NewProjectRuntimeInfo("go", nil),
Backend: &workspace.ProjectBackend{
URL: "<s3://project-gaia?endpoint=http://localhost:4566&disableSSL=true&s3ForcePathStyle=true>",
},
}),
}
s, err := auto.UpsertStackInlineSource(ctx, stackName, stackName, program, opts...)
//s, err := auto.NewStackInlineSource(ctx, stackName, stackName, program)
if err != nil {
if auto.IsCreateStack409Error(err) {
w.WriteHeader(409)
fmt.Fprintf(w, fmt.Sprintf("stack %q already exists", stackName))
return
}
w.WriteHeader(500)
fmt.Fprintf(w, err.Error())
return
}
s.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: "eu-west-1"})
upRes, err := s.Up(ctx, optup.ProgressStreams(os.Stdout))
if err != nil {
w.WriteHeader(500)
fmt.Fprintf(w, err.Error())
return
}
response := &PolicyResponse{
Name: stackName,
PolicyArn: upRes.Outputs["policyArn"].Value.(string),
RoleArn: upRes.Outputs["roleArn"].Value.(string),
}
err = json.NewEncoder(w).Encode(&response)
if err != nil {
return
}
}