We are trying to create empty databases & data...
# google-cloud
l
We are trying to create empty databases & database users in a Cloud SQL MySQL setup. The system running
pulumi-up
is not in the same VPC as the DB setup, so we want to integrate
cloud_sql_proxy
in our code setup. Starting the proxy via NodeJS
child_process
works, but we are searching the correct place in our code to stop the proxy after the
mysql.Grant
resources have been created/updated:
Copy code
const ddl = new mysql.Grant(
    config.dbDDLUsername,
    {
      user: DDLUser.name,
      database: database.name,
      privileges: ["CREATE", "ALTER", "DROP"],
      host: "%",
    },
    {
      provider: mysqlProvider
    }
  );

  const dml = new mysql.Grant(
    config.dbDMLUsername,
    {
      user: DMLUser.name,
      database: database.name,
      privileges: ["UPDATE", "INSERT", "SELECT", "INDEX", "DELETE"],
      host: "%",
    },
    {
      provider: mysqlProvider
    }
  );

  pulumi.all([ddl.id, dml.id]).apply(async () => {
    console.log(`>>>>> Killing cloud_sql_proxy... <<<<<`);
    sqlProxyProcess.kill();
  });
Pulumi is hanging now and is not killing the child process. Any ideas?