From 5d810780510ad0402f466a7b05d884e275df2ba1 Mon Sep 17 00:00:00 2001
From: mamari90 <130982006+mamari90@users.noreply.github.com>
Date: Mon, 6 Nov 2023 14:48:37 +0100
Subject: [PATCH] added private dns registration
---
postgres_flexible_server/04_variables.tf | 16 ++++++++--------
postgres_flexible_server/README.md | 6 ++++++
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/postgres_flexible_server/04_variables.tf b/postgres_flexible_server/04_variables.tf
index 05a39dbc..8a7b0cfe 100644
--- a/postgres_flexible_server/04_variables.tf
+++ b/postgres_flexible_server/04_variables.tf
@@ -293,26 +293,26 @@ variable "tags" {
}
variable "private_dns_registration" {
- type = bool
- default = false
+ type = bool
+ default = false
description = "(Optional) If true, creates a cname record for the newly created postgreSQL db fqdn into the provided private dns zone"
}
variable "private_dns_zone_name" {
- type = string
- default = null
+ type = string
+ default = null
description = "(Optional) if 'private_dns_registration' is true, defines the private dns zone name in which the server fqdn should be registered"
}
variable "private_dns_zone_rg_name" {
- type = string
- default = null
+ type = string
+ default = null
description = "(Optional) if 'private_dns_registration' is true, defines the private dns zone resource group name of the dns zone in which the server fqdn should be registered"
}
variable "private_dns_cname" {
- type = string
- default = null
+ type = string
+ default = null
description = "(Optional) if 'private_dns_registration' is true, defines the private dns CNAME used to register this server FQDN"
}
diff --git a/postgres_flexible_server/README.md b/postgres_flexible_server/README.md
index fd514a74..76a132a7 100644
--- a/postgres_flexible_server/README.md
+++ b/postgres_flexible_server/README.md
@@ -264,6 +264,7 @@ module "postgres_flexible_server_private" {
private_dns_registration = true
private_dns_zone_name = "${var.env_short}.internal.postgresql.pagopa.it"
private_dns_zone_rg_name = data.azurerm_resource_group.data_rg.name
+ private_dns_cname = "my-service-db"
}
@@ -304,6 +305,7 @@ No modules.
| [azurerm_monitor_metric_alert.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_metric_alert) | resource |
| [azurerm_postgresql_flexible_server.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server) | resource |
| [azurerm_postgresql_flexible_server_configuration.pgbouncer_enabled](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server_configuration) | resource |
+| [azurerm_private_dns_cname_record.example](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_cname_record) | resource |
| [null_resource.ha_sku_check](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.pgbouncer_check](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
@@ -333,7 +335,11 @@ No modules.
| [name](#input\_name) | (Required) The name which should be used for this PostgreSQL Flexible Server. Changing this forces a new PostgreSQL Flexible Server to be created. | `string` | n/a | yes |
| [pgbouncer\_enabled](#input\_pgbouncer\_enabled) | Is PgBouncer enabled into configurations? | `bool` | `true` | no |
| [primary\_user\_assigned\_identity\_id](#input\_primary\_user\_assigned\_identity\_id) | Manages a User Assigned Identity | `string` | `null` | no |
+| [private\_dns\_cname](#input\_private\_dns\_cname) | (Optional) if 'private\_dns\_registration' is true, defines the private dns CNAME used to register this server FQDN | `string` | `null` | no |
+| [private\_dns\_registration](#input\_private\_dns\_registration) | (Optional) If true, creates a cname record for the newly created postgreSQL db fqdn into the provided private dns zone | `bool` | `false` | no |
| [private\_dns\_zone\_id](#input\_private\_dns\_zone\_id) | (Optional) The ID of the private dns zone to create the PostgreSQL Flexible Server. Changing this forces a new PostgreSQL Flexible Server to be created. | `string` | `null` | no |
+| [private\_dns\_zone\_name](#input\_private\_dns\_zone\_name) | (Optional) if 'private\_dns\_registration' is true, defines the private dns zone name in which the server fqdn should be registered | `string` | `null` | no |
+| [private\_dns\_zone\_rg\_name](#input\_private\_dns\_zone\_rg\_name) | (Optional) if 'private\_dns\_registration' is true, defines the private dns zone resource group name of the dns zone in which the server fqdn should be registered | `string` | `null` | no |
| [private\_endpoint\_enabled](#input\_private\_endpoint\_enabled) | Is this instance private only? | `bool` | n/a | yes |
| [resource\_group\_name](#input\_resource\_group\_name) | (Required) The name of the Resource Group where the PostgreSQL Flexible Server should exist. | `string` | n/a | yes |
| [sku\_name](#input\_sku\_name) | The SKU Name for the PostgreSQL Flexible Server. The name of the SKU, follows the tier + name pattern (e.g. B\_Standard\_B1ms, GP\_Standard\_D2s\_v3, MO\_Standard\_E4s\_v3). | `string` | n/a | yes |