How can I run a `mysql.Grant` against my `gcp.sql....
# general
i
How can I run a
mysql.Grant
against my
gcp.sql.DatabaseInstance
? We run our db schema create etc inside a container with a cloud sql proxy sidecar, but I’m working an a per-PR set of stacks and want to run a grant to limit a per-PR user to a per-PR schema. As I have it, the
pulumi up
just hangs indefinitely (no error, and timeouts don’t work).
b
Couple of questions: What do the logs say:
pulumi up --yes --logtostderr --logflow -v=10 2> logs.log
? How are you setting the timeouts? Are you using the
customTimeouts
resource option?
i
I tried all the timeouts. Every potential one I could find, but they had no effect. Ultimately, it comes down to the simple fact that my deployment env (local during dev) doesn’t have a sql proxy (and neither does ci). So I need to set this up as a Kubenetes job similar to our db create/migrate with a proxy sidecar.
m
You could force a timeout, I think, by using a local command and a timeout flag.
Copy code
const grant = new command.local.Command("testMysqlConnection", {
  create: `
    mysql --connect-timeout=5 -h ..." \
      -e "SELECT 1;"
  `,
};
b
It sounds like wherever you're running the Pulumi CLI from doesn't have access to the mysql database, is this correct?
i
Yes, because no local proxy is running in that env.
b
The CLI will need to have access to the MySQL database to be able to deploy the "grant" resource.
I suspect it's timing out because the CLI will keep trying to connect over the time but there's nothing to reject the request, it's just hanging
i
The CLI will need to have access to the MySQL database to be able to deploy the “grant” resource.
Yes, that is what I have already said.
I suspect it’s timing out
It does not time out though. No timeout works. It would have been nice if it did, but the point is moot, since I need to make it work in all environments e.g. use a job with a proxy pattern.