Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-bitonti committed Nov 24, 2023
1 parent 64b5acc commit 335c7cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/cloudsql-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ resource "google_sql_database_instance" "primary" {

ip_configuration {
ipv4_enabled = var.network_config.connectivity.public_ipv4
private_network = var.network_config.connectivity.psa_config.private_network
private_network = try(var.network_config.connectivity.psa_config.private_network, null)
allocated_ip_range = try(var.network_config.connectivity.psa_config.allocated_ip_ranges.primary, null)
require_ssl = var.network_config.require_ssl
dynamic "authorized_networks" {
Expand Down Expand Up @@ -157,7 +157,7 @@ resource "google_sql_database_instance" "replicas" {

ip_configuration {
ipv4_enabled = var.network_config.connectivity.public_ipv4
private_network = var.network_config.connectivity.psa_config.private_network
private_network = try(var.network_config.connectivity.psa_config.private_network, null)
allocated_ip_range = try(var.network_config.connectivity.psa_config.allocated_ip_ranges.replica, null)
dynamic "authorized_networks" {
for_each = var.network_config.authorized_networks != null ? var.network_config.authorized_networks : {}
Expand Down
2 changes: 1 addition & 1 deletion modules/cloudsql-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ variable "network_config" {
})
})
validation {
condition = (var.network_config.connectivity.psa_config.private_network != null ? 1 : 0) + (var.network_config.connectivity.psc_allowed_consumer_projects != null ? 1 : 0) < 2
condition = (var.network_config.connectivity.psa_config != null ? 1 : 0) + (var.network_config.connectivity.psc_allowed_consumer_projects != null ? 1 : 0) < 2
error_message = "Only one between private network and psc can be specified."
}
}
Expand Down

0 comments on commit 335c7cd

Please sign in to comment.