Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 1cebdf2

Browse files
committed
make dns_servers a separated resource block
1 parent 3b7a352 commit 1cebdf2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ No modules.
212212
| [azurerm_subnet_network_security_group_association.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_network_security_group_association) | resource |
213213
| [azurerm_subnet_route_table_association.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_route_table_association) | resource |
214214
| [azurerm_virtual_network.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network) | resource |
215+
| [azurerm_virtual_network_dns_servers.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network_dns_servers) | resource |
215216

216217
## Inputs
217218

main.tf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ resource "azurerm_virtual_network" "vnet" {
44
name = var.vnet_name
55
resource_group_name = var.resource_group_name
66
bgp_community = var.bgp_community
7-
dns_servers = var.dns_servers
87
tags = merge(var.tags, (/*<box>*/ (var.tracing_tags_enabled ? { for k, v in /*</box>*/ {
98
avm_git_commit = "2b2f05969200c71b6609f4cdfa9120d48af55537"
109
avm_git_file = "main.tf"
@@ -24,6 +23,18 @@ resource "azurerm_virtual_network" "vnet" {
2423
id = ddos_protection_plan.value.id
2524
}
2625
}
26+
lifecycle {
27+
ignore_changes = [
28+
dns_servers,
29+
]
30+
}
31+
}
32+
33+
resource "azurerm_virtual_network_dns_servers" "this" {
34+
count = var.dns_servers != null ? 1 : 0
35+
36+
virtual_network_id = azurerm_virtual_network.vnet.id
37+
dns_servers = var.dns_servers
2738
}
2839

2940
moved {

0 commit comments

Comments
 (0)