Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions infrastructure/modules/private-dns-zone-resolver/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
8 changes: 5 additions & 3 deletions infrastructure/modules/private-dns-zone-resolver/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following input variables are optional (have default values):

### <a name="input_inbound_endpoint_config"></a> [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:

Expand All @@ -43,6 +43,7 @@ object({
name = string
private_ip_allocation_method = string
subnet_id = string
private_ip_address = optional(string, null)
})
```

Expand All @@ -51,8 +52,9 @@ Default:
```json
{
"name": "",
"private_ip_allocation_method": "",
"subnet_id": ""
"private_ip_allocation_method": "Dynamic",
"subnet_id": "",
"private_ip_address": null
}
```

Expand Down
14 changes: 13 additions & 1 deletion infrastructure/modules/private-dns-zone-resolver/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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'."
}
}

Expand Down