Skip to content

Commit

Permalink
Adjust networking for DB
Browse files Browse the repository at this point in the history
  • Loading branch information
wawrzek committed Oct 15, 2024
1 parent 2fd5787 commit 3843089
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ No modules.
| <a name="input_db-version"></a> [db-version](#input\_db-version) | DB type and version (e.g. POSTGRES\_14) | `string` | `"POSTGRES_14"` | no |
| <a name="input_deletion-protection"></a> [deletion-protection](#input\_deletion-protection) | Delete protection of DB | `bool` | `true` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the DB | `string` | n/a | yes |
| <a name="input_network-id"></a> [network-id](#input\_network-id) | ID of the network | `string` | n/a | yes |
| <a name="input_network-name"></a> [network-name](#input\_network-name) | Name for the network | `string` | n/a | yes |
| <a name="input_private-network"></a> [private-network](#input\_private-network) | Switch to connect to a private network | `bool` | `true` | no |
| <a name="input_project"></a> [project](#input\_project) | Name of the GCP project | `string` | `"ivynet-tests"` | no |
Expand Down
7 changes: 2 additions & 5 deletions postgres/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ resource "google_sql_database_instance" "this" {
dynamic "ip_configuration" {
for_each = var.private-network ? [1] : []
content {
ipv4_enabled = false
psc_config {
psc_enabled = true
allowed_consumer_projects = [var.project]
}
ipv4_enabled = false
private_network = var.network-id
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions postgres/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ variable "name" {
type = string
}

variable "network-id" {
description = "ID of the network"
type = string
}

variable "network-name" {
description = "Name for the network"
type = string
Expand Down

0 comments on commit 3843089

Please sign in to comment.