This is a Hashicorp Vault database plugin to connect to CloudSQL instances with GoogleCloudPlatform/cloud-sql-go-connector.
1.8.x.
Stay tuned as we add support for newer Hashicorp Vault versions.From Google Cloud's documentation:
Using the Cloud SQL Auth proxy is the recommended method for connecting to a Cloud SQL instance. See: Connect using the Cloud SQL Auth proxy
By using the cloud-sql-go-connector Hashicorp Vault is able to connect to multiple CloudSQL instances without the need for the Cloud SQL Auth Proxy.
This plugin does two things:
NOTE: Currently support is limited to Postgres instances.
The following plugin arguments are supported:
-db-type, defaults to cloudsql-postgres.
This is currently the only supported database type.-log-level, defaults to infomultiplex, defaults to trueBuild the plugin binary for your target architecture:
make build
After the plugin is built, it must be made available to the Vault server runtime.
Move the compiled plugin into Vault's configured plugin_directory:
# in the following example the `plugin_directory` is `/etc/vault/plugins`
mv vault-plugin-database-cloudsql /etc/vault/plugins/vault-plugin-database-cloudsql
# save the output of this to register your plugin on the next step
sha256sum /app/bin/plugins/vault-plugin-database-cloudsql
After building this plugin and making it available to your Vault runtime, you can register the plugin to the plugin catalog like this:
resource "vault_generic_endpoint" "configure_custom_cloudsql_plugin" {
path = "sys/plugins/catalog/database/vault-plugin-database-cloudsql"
disable_read = false
disable_delete = false
ignore_absent_fields = true
data_json = jsonencode({
type = "database"
sha_256 = <INSERT-YOUR-BINARY-SHA>
command = "vault-plugin-database-cloudsql"
args = [
"-db-type=cloudsql-postgres",
"-log-level=info"
]
})
}
In order to run unit tests, run the following command:
make test
$ claude mcp add vault-plugin-database-cloudsql \
-- python -m otcore.mcp_server <graph>