petoju / terraform-provider-mysql

Terraform MySQL provider – unofficial fork
https://registry.terraform.io/providers/petoju/mysql
Mozilla Public License 2.0
63 stars 40 forks source link

GCP Cloud SQL - Add support for PRIVATE_IP #117

Closed 6uellerBpanda closed 3 months ago

6uellerBpanda commented 4 months ago

Hi

We're using for our Cloud SQL instances private ip option. The cloud.google.com/go/cloudsqlconn has the necessary https://pkg.go.dev/cloud.google.com/go/cloudsqlconn#WithPrivateIP option but it's missing at the provider.

It would be great if this would be possible to set. thanks.

The terraform run fails when specifying endpoint = "cloudsql://<INSTANCE>":

Debug Output

│ Error: failed getting database from Meta: failed to connect to MySQL: could not create new connection: could not connect to server: Config error: instance does not have IP of type "PUBLIC" (connection name = "<INSTANCE>")

References

petoju commented 4 months ago

Two fixes come to my mind:

  1. Add it to endpoint and strip it when connecting
  2. Add another field called like endpointParams

Both are fine, but I cannot easily test it now. PRs are welcome.

petoju commented 3 months ago

This was fixed (thanks mario-pany) and released.