From 855985b82cad0de9c11dface5838d6b307610806 Mon Sep 17 00:00:00 2001 From: Maciej Murawski Date: Thu, 18 Jun 2026 11:22:31 +0100 Subject: [PATCH 1/2] feat: add a static inbound option for the private dns resolver --- .../modules/private-dns-zone-resolver/main.tf | 1 + .../modules/private-dns-zone-resolver/variables.tf | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/infrastructure/modules/private-dns-zone-resolver/main.tf b/infrastructure/modules/private-dns-zone-resolver/main.tf index 8dc9b124..41348148 100644 --- a/infrastructure/modules/private-dns-zone-resolver/main.tf +++ b/infrastructure/modules/private-dns-zone-resolver/main.tf @@ -18,6 +18,7 @@ resource "azurerm_private_dns_resolver_inbound_endpoint" "private_dns_resolver_i ip_configurations { private_ip_allocation_method = var.inbound_endpoint_config.private_ip_allocation_method + private_ip_address = var.inbound_endpoint_config.private_ip_allocation_method == "Static" ? var.inbound_endpoint_config.private_ip_address : null subnet_id = var.inbound_endpoint_config.subnet_id } } diff --git a/infrastructure/modules/private-dns-zone-resolver/variables.tf b/infrastructure/modules/private-dns-zone-resolver/variables.tf index 3e63d446..e27cd5c9 100644 --- a/infrastructure/modules/private-dns-zone-resolver/variables.tf +++ b/infrastructure/modules/private-dns-zone-resolver/variables.tf @@ -23,11 +23,23 @@ variable "inbound_endpoint_config" { name = string private_ip_allocation_method = string subnet_id = string + private_ip_address = optional(string, null) }) default = { name = "" - private_ip_allocation_method = "" + private_ip_allocation_method = "Dynamic" subnet_id = "" + private_ip_address = null + } + + validation { + condition = contains(["Static", "Dynamic"], var.inbound_endpoint_config.private_ip_allocation_method) + error_message = "inbound_endpoint_config.private_ip_allocation_method must be either 'Static' or 'Dynamic'." + } + + validation { + condition = !(var.inbound_endpoint_config.private_ip_allocation_method == "Static" && var.inbound_endpoint_config.private_ip_address == null) + error_message = "inbound_endpoint_config.private_ip_address must be provided when private_ip_allocation_method is set to 'Static'." } } From 62e933b4243b51f08601ffded940b9f07a406ef2 Mon Sep 17 00:00:00 2001 From: Maciej Murawski Date: Fri, 19 Jun 2026 11:19:21 +0100 Subject: [PATCH 2/2] docs: updated the tfdocs.md file --- .../modules/private-dns-zone-resolver/tfdocs.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/infrastructure/modules/private-dns-zone-resolver/tfdocs.md b/infrastructure/modules/private-dns-zone-resolver/tfdocs.md index 8f9513df..ab990984 100644 --- a/infrastructure/modules/private-dns-zone-resolver/tfdocs.md +++ b/infrastructure/modules/private-dns-zone-resolver/tfdocs.md @@ -34,7 +34,7 @@ The following input variables are optional (have default values): ### [inbound\_endpoint\_config](#input\_inbound\_endpoint\_config) -Description: The configuration for the inbound endpoint. +Description: The configuration for the inbound endpoint. `private_ip_allocation_method` must be either `"Static"` or `"Dynamic"`. `private_ip_address` is optional but **required** when `private_ip_allocation_method` is set to `"Static"`. Type: @@ -43,6 +43,7 @@ object({ name = string private_ip_allocation_method = string subnet_id = string + private_ip_address = optional(string, null) }) ``` @@ -51,8 +52,9 @@ Default: ```json { "name": "", - "private_ip_allocation_method": "", - "subnet_id": "" + "private_ip_allocation_method": "Dynamic", + "subnet_id": "", + "private_ip_address": null } ```