diff --git a/modules/gcp_sql/instance.tf b/modules/gcp_sql/instance.tf index 84c538d..bb401c7 100644 --- a/modules/gcp_sql/instance.tf +++ b/modules/gcp_sql/instance.tf @@ -29,7 +29,9 @@ resource "google_sql_database_instance" "this" { } ip_configuration { - require_ssl = true + ipv4_enabled = false + private_network = var.vpc_network_link + require_ssl = true } maintenance_window { diff --git a/modules/gcp_sql/variables.tf b/modules/gcp_sql/variables.tf index 1c3f225..6634829 100644 --- a/modules/gcp_sql/variables.tf +++ b/modules/gcp_sql/variables.tf @@ -53,6 +53,12 @@ variable "memory" { } } +variable "vpc_network_link" { + description = "The resource name of the VPC e.g. projects/{project}/global/networks/{vpc_name}" + type = string + nullable = false +} + variable "deletion_protection" { description = "While set to true the instance cannot be deleted" type = bool