File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,14 @@ resource "google_sql_database_instance" "main" {
2323 ip_configuration {
2424 private_network = var. network
2525 ipv4_enabled = var. ipv4_enabled
26- ssl_mode = " ALLOW_UNENCRYPTED_AND_ENCRYPTED"
26+ ssl_mode = var. ipv4_enabled ? " ENCRYPTED_ONLY" : " ALLOW_UNENCRYPTED_AND_ENCRYPTED"
27+ dynamic "authorized_networks" {
28+ for_each = var. ipv4_enabled ? var. authorized_networks : []
29+ content {
30+ name = authorized_networks. value . name
31+ value = authorized_networks. value . value
32+ }
33+ }
2734 }
2835
2936 availability_type = " REGIONAL"
Original file line number Diff line number Diff line change @@ -46,3 +46,12 @@ variable "ipv4_enabled" {
4646 type = bool
4747 default = false
4848}
49+
50+ variable "authorized_networks" {
51+ description = " List of authorized networks for public access. Each object must have 'name' and 'value' (subnet/CIDR)."
52+ type = list (object ({
53+ name = string
54+ value = string
55+ }))
56+ default = []
57+ }
You can’t perform that action at this time.
0 commit comments