Skip to content

Commit d171349

Browse files
committed
feat: added custom names for resources
1 parent a5465e1 commit d171349

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ module "dns" {
4242
## Requirements
4343

4444
| Name | Version |
45-
|---------------------------------------------------------------------------|-----------|
45+
| ------------------------------------------------------------------------- | --------- |
4646
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
4747
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.40.0 |
4848

4949
## Providers
5050

5151
| Name | Version |
52-
|---------------------------------------------------------------|---------|
52+
| ------------------------------------------------------------- | ------- |
5353
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.40.0 |
5454

5555
## Modules
@@ -59,17 +59,14 @@ No modules.
5959
## Resources
6060

6161
| Name | Type |
62-
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
62+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
6363
| [azurerm_private_dns_zone.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_zone) | resource |
6464
| [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 |
6565

6666
## Inputs
6767

6868
| Name | Description | Type | Default | Required |
69-
|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|---------------|---------|:--------:|
70-
| <a name="input_env"></a> [env](#input\_env) | The prefix which should be used for all resources in this environment | `string` | n/a | yes |
71-
| <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 |
72-
| <a name="input_project"></a> [project](#input\_project) | Project/stream name (e.g. datalake) | `string` | n/a | yes |
69+
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------- | ------- | :------: |
7370
| <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 |
7471
| <a name="input_tags"></a> [tags](#input\_tags) | list of tags | `map(string)` | `{}` | no |
7572
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Custom prefix to add to resource name | `string` | `""` | no |
@@ -80,7 +77,7 @@ No modules.
8077
## Outputs
8178

8279
| Name | Description |
83-
|----------------------------------------------------------------------------------|----------------------------------|
80+
| -------------------------------------------------------------------------------- | -------------------------------- |
8481
| <a name="output_id"></a> [id](#output\_id) | Private DNS Zone Id |
8582
| <a name="output_name"></a> [name](#output\_name) | Private DNS Zone Name |
8683
| <a name="output_resource_group"></a> [resource\_group](#output\_resource\_group) | Private DNS Zone Resource Group |

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
locals {
2-
prefix = length(var.prefix) == 0 ? "" : "${var.prefix}-"
2+
prefix = length(var.prefix) == 0 ? "" : "${var.prefix}-"
3+
private_dns_zone_vnet_link = var.custom_dns_zone_vnet_link_name == null ? "link-${local.prefix}${each.key}" : "${local.prefix}${var.custom_dns_zone_vnet_link_name}"
34
}
45

56
resource "azurerm_private_dns_zone" "this" {
@@ -13,7 +14,7 @@ resource "azurerm_private_dns_zone" "this" {
1314
resource "azurerm_private_dns_zone_virtual_network_link" "this" {
1415
for_each = var.vnet_map
1516

16-
name = "link-${local.prefix}${each.key}"
17+
name = local.private_dns_zone_vnet_link
1718
private_dns_zone_name = length(var.dns_zone_name) == 0 ? var.external_dns_zone_name : azurerm_private_dns_zone.this[0].name
1819
resource_group_name = var.resource_group
1920
virtual_network_id = each.value

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ variable "resource_group" {
33
description = "Azure location"
44
}
55

6+
variable "custom_dns_zone_vnet_link_name" {
7+
type = string
8+
description = "The name of the Private DNS Zone Virtual Network Link"
9+
default = null
10+
}
11+
612
variable "tags" {
713
type = map(string)
814
description = "Resource tags"

0 commit comments

Comments
 (0)