hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.63k forks source link

Support for DNS Nameserver overwrites #6465

Closed mleklund closed 3 years ago

mleklund commented 4 years ago

Community Note

Description

Allow overwrites of non-imported dns nameserver records. Since this record is created automatically when we create a zone it never gets imported into our terraform state, thus cannot be modified without a manual import. I understand why we do not want terraform to be allowed to modify existing resources, but this is an odd edge case. AWS records allow overwrite, explicitly for this reason.

When creating Route 53 zones, the NS and SOA records for the zone are automatically created. Enabling the allow_overwrite argument will allow managing these records in a single Terraform run without the requirement for terraform import.

New or Affected Resource(s)

Potential Terraform Configuration

resource "azurerm_dns_ns_record" "nameservers" {
      name                = "@"
      records             = [
          "ns-1478.awsdns-56.org",
          "ns-1881.awsdns-43.co.uk",
          "ns-863.awsdns-43.net",
          "ns-93.awsdns-11.com",
          "ns1-03.azure-dns.com.",
          "ns2-03.azure-dns.net.",
          "ns3-03.azure-dns.org.",
          "ns4-03.azure-dns.info.",
        ]
      resource_group_name = "main"
      ttl                 = 86400
      zone_name           = "example.com"
      allow_overwrite = true
    }

References

mleklund commented 4 years ago

The NS record set at the zone apex (name '@') is created automatically with each DNS zone, and is deleted automatically when the zone is deleted (it cannot be deleted separately). This record set contains the names of the Azure DNS name servers assigned to the zone. You can add additional name servers to this NS record set, to support co-hosting domains with more than one DNS provider. You can also modify the TTL and metadata for this record set. However, you cannot remove or modify the pre-populated Azure DNS name servers. This applies only to the NS record set at the zone apex. Other NS record sets in your zone (as used to delegate child zones) can be created, modified, and deleted without constraint.

So, it looks like you can only append, and not overwrite. So that ability would be nice, though I am not sure how to handle that.

favoretti commented 3 years ago

Since this issue has been reported a long time ago and relates to the version of provider we no longer support - I'm going to close it. Please open a new updated bug report on current versions of terraform and provider if this is still relevant. Thank you.

github-actions[bot] commented 3 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.