Skip to content

Commit 89a623d

Browse files
authored
Merge pull request #2 from data-platform-hq/add-module
feat: add module
2 parents 26ce7d3 + 61c5a4f commit 89a623d

File tree

5 files changed

+118
-0
lines changed

5 files changed

+118
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,51 @@ Terraform module for creation Azure <>
44
## Usage
55

66
<!-- BEGIN_TF_DOCS -->
7+
## Requirements
8+
9+
| Name | Version |
10+
|---------------------------------------------------------------------------|-----------|
11+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
12+
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.23.0 |
13+
14+
## Providers
15+
16+
| Name | Version |
17+
|---------------------------------------------------------------|---------|
18+
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.24.0 |
19+
20+
## Modules
21+
22+
No modules.
23+
24+
## Resources
25+
26+
| Name | Type |
27+
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
28+
| [azurerm_private_dns_zone.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_zone) | resource |
29+
| [azurerm_private_dns_zone_virtual_network_link.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_zone_virtual_network_link) | resource |
30+
31+
## Inputs
32+
33+
| Name | Description | Type | Default | Required |
34+
|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|---------------|-------------------------------------|:--------:|
35+
| <a name="input_create_private_zone"></a> [create\_private\_zone](#input\_create\_private\_zone) | Condition for Private DNS Zone creation | `bool` | n/a | yes |
36+
| <a name="input_env"></a> [env](#input\_env) | The prefix which should be used for all resources in this environment | `string` | n/a | yes |
37+
| <a name="input_location"></a> [location](#input\_location) | The Azure Region in which all resources in this example should be created. | `string` | n/a | yes |
38+
| <a name="input_project"></a> [project](#input\_project) | Project/stream name (e.g. datalake) | `string` | n/a | yes |
39+
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | The Azure Region in which all resources in this example should be created. | `string` | n/a | yes |
40+
| <a name="input_tags"></a> [tags](#input\_tags) | list of tags | `map(string)` | n/a | yes |
41+
| <a name="input_dns_zone_name"></a> [dns\_zone\_name](#input\_dns\_zone\_name) | Name of Private DNS Zone | `string` | `"privatelink.azuredatabricks.net"` | no |
42+
| <a name="input_vnet_map"></a> [vnet_map](#input\_vnet\_map) | Map of Virtual Network Name to Id, used to create VNet Link to Private DNS | `map(string)` | `{}` | no |
43+
| <a name="input_external_dns_zone_name"></a> [external\_dns\_zone\_name](#input\_external\_dns\_zone\_name) | Name of Imported Private DNS Zone. Provide value in case creation of new Private DNS Zone is disabled | `string` | `""` | no |
44+
45+
## Outputs
46+
47+
| Name | Description |
48+
|-------------------------------------------------------|----------------------------------|
49+
| <a name="output_id"></a> [id](#output\_id) | Private DNS Zone Id |
50+
| <a name="output_name"></a> [id](#output\_name) | Private DNS Zone Name |
51+
| <a name="output_link_id"></a> [id](#output\_link\_id) | List of Virtual Network Link Ids |
752

853
<!-- END_TF_DOCS -->
954

main.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "azurerm_private_dns_zone" "this" {
2+
count = var.create_private_zone == true ? 1 : 0
3+
4+
name = var.dns_zone_name
5+
resource_group_name = var.resource_group
6+
tags = var.tags
7+
}
8+
9+
resource "azurerm_private_dns_zone_virtual_network_link" "this" {
10+
for_each = var.vnet_map == {} ? {} : { for k, v in var.vnet_map : k => v }
11+
12+
name = "link-${each.key}"
13+
private_dns_zone_name = var.create_private_zone == true ? azurerm_private_dns_zone.this[0].name : var.external_dns_zone_name
14+
resource_group_name = var.resource_group
15+
virtual_network_id = each.value
16+
tags = var.tags
17+
}

outputs.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
output "id" {
2+
value = var.create_private_zone == true ? azurerm_private_dns_zone.this[0].id : ""
3+
description = "Private DNS Zone Id"
4+
}
5+
6+
output "name" {
7+
value = var.create_private_zone == true ? azurerm_private_dns_zone.this[0].name : ""
8+
description = "Private DNS Zone Name"
9+
}
10+
11+
output "link_id" {
12+
value = var.vnet_map == {} ? [] : [for vnet_link in azurerm_private_dns_zone_virtual_network_link.this : vnet_link.id]
13+
description = "List of Virtual Network Link Ids"
14+
}

variables.tf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
variable "create_private_zone" {
2+
type = bool
3+
description = "Condition for Private DNS Zone creation"
4+
}
5+
6+
variable "resource_group" {
7+
type = string
8+
description = "Azure location"
9+
}
10+
11+
variable "tags" {
12+
type = map(string)
13+
description = "Resource tags"
14+
}
15+
16+
variable "dns_zone_name" {
17+
type = string
18+
description = "Name of Private DNS Zone"
19+
default = "privatelink.azuredatabricks.net"
20+
}
21+
22+
variable "vnet_map" {
23+
type = map(string)
24+
description = "Map of Virtual Network Name to Id, used to create VNet Link to Private DNS"
25+
default = {}
26+
}
27+
28+
variable "external_dns_zone_name" {
29+
type = string
30+
description = "Name of Imported Private DNS Zone. Provide value in case creation of new Private DNS Zone is disabled"
31+
default = ""
32+
}

versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.0.0"
3+
4+
required_providers {
5+
azurerm = {
6+
source = "hashicorp/azurerm"
7+
version = ">= 3.23.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)