-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
133 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,17 @@ | ||
resource "azurerm_private_dns_zone" "this" { | ||
count = var.create_private_zone == true ? 1 : 0 | ||
|
||
name = var.dns_zone_name | ||
resource_group_name = var.resource_group | ||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_private_dns_zone_virtual_network_link" "this" { | ||
for_each = var.vnet_map == {} ? {} : { for k, v in var.vnet_map : k => v } | ||
|
||
name = "link-${each.key}" | ||
private_dns_zone_name = var.create_private_zone == true ? azurerm_private_dns_zone.this[0].name : var.external_dns_zone_name | ||
resource_group_name = var.resource_group | ||
virtual_network_id = each.value | ||
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,14 @@ | ||
output "id" { | ||
value = var.create_private_zone == true ? azurerm_private_dns_zone.this[0].id : "" | ||
description = "Private DNS Zone Id" | ||
} | ||
|
||
output "name" { | ||
value = var.create_private_zone == true ? azurerm_private_dns_zone.this[0].name : "" | ||
description = "Private DNS Zone Name" | ||
} | ||
|
||
output "link_id" { | ||
value = var.vnet_map == {} ? [] : [for vnet_link in azurerm_private_dns_zone_virtual_network_link.this : vnet_link.id] | ||
description = "List of Virtual Network Link Ids" | ||
} |
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,47 @@ | ||
variable "create_private_zone" { | ||
type = bool | ||
description = "Condition for Private DNS Zone creation" | ||
} | ||
|
||
variable "project" { | ||
type = string | ||
description = "Project name" | ||
} | ||
|
||
variable "env" { | ||
type = string | ||
description = "Environment name" | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "Azure location" | ||
} | ||
|
||
variable "resource_group" { | ||
type = string | ||
description = "Azure location" | ||
} | ||
|
||
variable "tags" { | ||
type = map(string) | ||
description = "Resource tags" | ||
} | ||
|
||
variable "dns_zone_name" { | ||
type = string | ||
description = "Name of Private DNS Zone" | ||
default = "privatelink.azuredatabricks.net" | ||
} | ||
|
||
variable "vnet_map" { | ||
type = map(string) | ||
description = "Map of Virtual Network Name to Id, used to create VNet Link to Private DNS" | ||
default = {} | ||
} | ||
|
||
variable "external_dns_zone_name" { | ||
type = string | ||
description = "Name of Imported Private DNS Zone. Provide value in case creation of new Private DNS Zone is disabled" | ||
default = "" | ||
} |
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,10 @@ | ||
terraform { | ||
required_version = ">= 1.0.0" | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">= 3.23.0" | ||
} | ||
} | ||
} |