Skip to content

Commit

Permalink
more work for private pg ip
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Jan 5, 2024
1 parent 611218c commit 001a8eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion terraform/clouds/azure/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ locals {
name = var.create_resource_group ? azurerm_resource_group.main[0].name : var.resource_group_name
location = var.location
}
db_url = format("postgresql://console:%s@%s:5432/console", random_password.password.result, try(module.postgresql[0].server_fqdn, ""))
db_url = format("postgresql://console:%s@%s:5432/console", random_password.password.result, try(azurerm_private_endpoint.pg[0].private_service_connection.private_ip_address, ""))
}
9 changes: 3 additions & 6 deletions terraform/clouds/azure/postgres.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,19 @@ module "postgresql" {
db_names = ["console"]
db_charset = "UTF8"
db_collation = "English_United States.1252"

vnet_rule_name_prefix = "plural-postgresql-vnet-rule-"
vnet_rules = [
{ name = "subnet1", subnet_id = azurerm_subnet.network.id }
]
}

resource "azurerm_private_endpoint" "pg" {
count = var.create_db ? 1 : 0

name = "${local.resource_group.name}-${local.db_name}"
location = local.resource_group.location
resource_group_name = local.resource_group.name
subnet_id = azurerm_subnet.network.id

private_service_connection {
name = "${local.resource_group.name}-${local.db_name}"
private_connection_resource_id = module.postgresql.server_id
private_connection_resource_id = module.postgresql[0].server_id
subresource_names = ["postgresqlServer"]
is_manual_connection = false
}
Expand Down

0 comments on commit 001a8eb

Please sign in to comment.