Skip to content

Commit

Permalink
feat(gcp sql): force instances to use private connections only
Browse files Browse the repository at this point in the history
  • Loading branch information
tweakster committed Dec 9, 2024
1 parent 227f081 commit 156ac96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/gcp_sql/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions modules/gcp_sql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 156ac96

Please sign in to comment.