https://pulumi.com logo
Title
c

colossal-ice-49128

07/21/2021, 12:25 AM
I’m trying to add an additional user to an aurora serverless cluster . I’m thinking this requires a lifecycle hook that isn’t implemented yet. If there’s a way to do this in Pulumi let me know otherwise we’ll script it later.
b

bored-table-20691

07/21/2021, 12:31 AM
Typically the way I’ve seen this done (e.g. with a normal Aurora cluster, which I don’t think is different in this regard) is one of two ways: 1. Use the Automation API to run your stack to create the username in Aurora (you’d do this using the Postgres provider) 2. Create the Aurora cluster in one project/stack, and reference it in another stack and create the user there. That said, typing this out, is there a reason you can’t just use the Postgres provider (or MySQL or whatever it is you’re using with Aurora) and construct it with the Aurora details?
c

colossal-ice-49128

07/21/2021, 2:24 AM
I tried doing that but I ran into this error which made me think I was going in the wrong direction. I’ll try the suggested fix in that thread (although that’s for terraform and may be difficult to apply to Pulumi).
b

bored-table-20691

07/21/2021, 2:36 AM
What does the code roughly look like
c

colossal-ice-49128

07/21/2021, 2:43 AM
const role = new postgres.Role("role", {
    login: true,
    name: "role",
    password: 'password'
})
  
const grant = new postgres.Grant("halo-application-grant", {
    database: theCluster.databaseName,
    objectType: "database",
    privileges: ["SELECT", "INSERT", "UPDATE", "DELETE"],
    role: role.name,
})
that’s what’s causing the error, I’m looking at how to set the provider option
superuser = false
as suggested
ok, making progress on this. I added
postgresql:superuser: false
to the stack config. But the serverless cluster takes a minute to warm up, so I still doubt I can run this without a delay or loop of some sort.
ok, got that working, thanks.
b

bored-table-20691

07/21/2021, 3:46 AM
Cool. I think generally Pulumi knows to wait until the cluster is done