-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PE-703] Private Endpoint Common module and CGN configuration (#1211)
- Loading branch information
Showing
9 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# CGN PostgreSQL Single Server | ||
|
||
data "azurerm_postgresql_server" "cgn_psql" { | ||
provider = azurerm.prod-cgn | ||
name = "cgnonboardingportal-p-db-postgresql" | ||
resource_group_name = "cgnonboardingportal-p-db-rg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
locals { | ||
private_endpoints = { | ||
"cgn-psql" = { | ||
"01" = { | ||
resource_id = data.azurerm_postgresql_server.cgn_psql.id | ||
subresource_names = ["postgresqlServer"] | ||
private_dns_zone_id = var.dns_zones.postgres.id | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
resource "azurerm_private_endpoint" "this" { | ||
for_each = merge([ | ||
for pep, instances in local.private_endpoints : { | ||
for i, values in instances : | ||
"${pep}-pep-${i}" => values | ||
} | ||
]...) | ||
|
||
name = "${var.project}-${each.key}" | ||
location = var.location | ||
resource_group_name = var.resource_group_name | ||
subnet_id = var.pep_snet_id | ||
|
||
private_service_connection { | ||
name = "${var.project}-${each.key}-pep-01" | ||
private_connection_resource_id = each.value.resource_id | ||
is_manual_connection = false | ||
subresource_names = each.value.subresource_names | ||
} | ||
|
||
private_dns_zone_group { | ||
name = "private-dns-zone-group" | ||
private_dns_zone_ids = [each.value.private_dns_zone_id] | ||
} | ||
|
||
tags = var.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "private_endpoints" { | ||
value = { | ||
for k, v in azurerm_private_endpoint.this : | ||
k => { | ||
name = v.name | ||
id = v.id | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
provider "azurerm" { | ||
alias = "prod-cgn" | ||
subscription_id = "74da48a3-b0e7-489d-8172-da79801086ed" | ||
|
||
features {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
variable "project" { | ||
type = string | ||
description = "IO prefix, short environment and short location" | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "Azure region" | ||
} | ||
|
||
variable "tags" { | ||
type = map(any) | ||
description = "Resource tags" | ||
} | ||
|
||
variable "resource_group_name" { | ||
type = string | ||
description = "Resource group namee" | ||
} | ||
|
||
variable "pep_snet_id" { | ||
type = string | ||
description = "ID of the private endpoint subnet" | ||
} | ||
|
||
variable "dns_zones" { | ||
type = map(any) | ||
description = <<EOF | ||
Map of private DNS zones | ||
Example: | ||
{ | ||
postgres = { | ||
'id' = 'XXXX' | ||
}, | ||
... | ||
} | ||
EOF | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters