terraform-google-sql-db icon indicating copy to clipboard operation
terraform-google-sql-db copied to clipboard

Easy private IP setup

Open j-windsor opened this issue 2 years ago • 1 comments

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

j-windsor avatar Sep 28 '22 17:09 j-windsor

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.

dataplex avatar Oct 07 '22 00:10 dataplex

@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

bharathkkb avatar Nov 07 '22 22:11 bharathkkb

@dataplex thanks for the report. I opened another issue to track your request.

bharathkkb avatar Nov 07 '22 22:11 bharathkkb