terraform-google-sql-db
terraform-google-sql-db copied to clipboard
Easy private IP setup
TL;DR
When I am creating a database in the Cloud Console, disabling the public IP and setting up a private IP is as easy a checking a box. Using the Postgres submodule in this repo, it is significantly more difficult, as you have to configure a google_compute_global_address
and a google_service_networking_connection
and wire it all together before applying your database.
The basic idea is to move the provisioning on these two resources into the database module so it is just as easy to configure private IPs here as it is in Cloud Console.
Terraform Resources
No response
Detailed design
No response
Additional information
No response
Another addition to this request would be a way to look up and automatically connect to the PSC network if it already exists. I'm following the Cloud Foundation Toolkit Example Foundation, and the PSC network, address allocation, etc, is created in the 3-networks step. I'm not working in an app-infra project (step 5) and need to create a Cloud SQL database in the project with a private IP. I can't find any documentation on how to do this either with this module or with the base Google terraform provider.
@j-windsor We have a private service access module that helps set this up. Here is an example https://github.com/terraform-google-modules/terraform-google-sql-db/blob/643e6e58c24560f936ee6bb0574cde17e080fb10/examples/mysql-private/main.tf#L40
@dataplex thanks for the report. I opened another issue to track your request.