diff --git a/infrastructure/modules/redis/main.tf b/infrastructure/modules/redis/main.tf index d3a7c5c1..29babb07 100644 --- a/infrastructure/modules/redis/main.tf +++ b/infrastructure/modules/redis/main.tf @@ -27,6 +27,11 @@ resource "azurerm_private_endpoint" "this" { location = var.resource_group.location subnet_id = azurerm_subnet.this.id + private_dns_zone_group { + name = "redis-${var.suffix}.com" + private_dns_zone_ids = [azurerm_private_dns_zone.this.id] + } + private_service_connection { name = "redis-pe-connection-${var.suffix}" private_connection_resource_id = azurerm_redis_cache.this.id @@ -35,3 +40,15 @@ resource "azurerm_private_endpoint" "this" { } } + +resource "azurerm_private_dns_zone" "this" { + name = "${var.suffix}.privatelink.redis.cache.windows.net" + resource_group_name = var.resource_group.name +} + +resource "azurerm_private_dns_zone_virtual_network_link" "this" { + name = "redis-${var.suffix}.com" + resource_group_name = var.resource_group.name + private_dns_zone_name = azurerm_private_dns_zone.this.name + virtual_network_id = var.network.virtual_network_id +}