Closed rstreefland closed 4 weeks ago
Hi @rstreefland thanks for raising an issue on the Cloud SQL Proxy 😄
You are correct that this is indeed not a supported feature in the Cloud SQL Proxy v2.
@enocom was there a reason this was not ported over to v2?
My assumption would be is that we don't want v2 to be dependent on gcloud internals.
For reference the code is here where v1 Proxy would connect to all Cloud SQL instances within the active gcloud project. We didn't port this feature because it had surprising behavior and prefer explicit configuration.
So, there are two options for v2:
--fuse
flag such that connections are established lazily.If neither of those fits what you're trying to do @rstreefland, I'd be curious to hear more about your use case.
For reference the code is here where v1 Proxy would connect to all Cloud SQL instances within the active gcloud project. We didn't port this feature because it had surprising behavior and prefer explicit configuration.
So, there are two options for v2:
- Explicitly list the instances you want to connect to (either as arguments or environment variables)
- Use the
--fuse
flag such that connections are established lazily.If neither of those fits what you're trying to do @rstreefland, I'd be curious to hear more about your use case.
@enocom Thanks for the explanation! Honestly it's just the lowest effort option when connecting to multiple databases in the same project for local development, but I'm not overly bothered that this doesn't exist in v2 as I could easily replicate it with bash.
What confused me is that the documentation has been updated for v2, but it still suggests that automatic instance discovery is possible: https://cloud.google.com/sql/docs/postgres/connect-auth-proxy#invocations https://cloud.google.com/sql/docs/postgres/sql-proxy#instances-options
What confused me is that the documentation has been updated for v2, but it still suggests that automatic instance discovery is possible: https://cloud.google.com/sql/docs/postgres/connect-auth-proxy#invocations https://cloud.google.com/sql/docs/postgres/sql-proxy#instances-options
@rstreefland Great catch! I'll get those removed right away, whoops 🙈
I have removed the automatic instance discovery samples from the public docs.
Thanks again for catching this @rstreefland 👏
Much appreciated 😄
Bug Description
The automatic instance discovery does not work with v2 of the proxy. It works as expected with v1 of the proxy but I've needed to upgrade to v2 to support automatic IAM database authentication.
Example code (or command)
Stacktrace
Steps to reproduce?
Environment
./cloud-sql-proxy --version
): cloud-sql-proxy version 2.11.3+darwin.arm64./cloud-sql-proxy --port 5432 INSTANCE_CONNECTION_NAME
): ./cloud-sql-proxy --unix-socket ./cloudsqlAdditional Details
No response