hashicorp / terraform-provider-dns

Utility provider that supports DNS updates (RFC 2136) and can optionally be configured with secret key based transaction authentication (RFC 2845).
https://registry.terraform.io/providers/hashicorp/dns/latest
Mozilla Public License 2.0
112 stars 71 forks source link

Allow managing root level NS records #129

Open Nothing4You opened 3 years ago

Nothing4You commented 3 years ago

Terraform Version

Terraform v0.14.9
+ provider registry.terraform.io/hashicorp/dns v3.1.0

Affected Resource(s)

Terraform Configuration Files

resource "dns_ns_record_set" "mydomain_tld" {
  zone = "mydomain.tld."

  nameservers = [
    "ns1.mydomain.tld",
    "ns2.mydomain.tld",
  ]
}

Output

Error: Missing required argument

  on main.tf line 23, in resource "dns_ns_record_set" "mydomain_tld":
  23: resource "dns_ns_record_set" "mydomain_tld" {

The argument "name" is required, but no definition was found.

Expected Behavior

Managing the NS records on the root domain should be possible, similar to how all the other record types like dns_a_record_set support this.

Actual Behavior

The "name" parameter is mandatory.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan
bodgit commented 3 years ago

IIRC this was intentional behaviour, you can't delete apex NS records, see #69 .

Nothing4You commented 3 years ago

it is possible to delete apex NS records, just not the last one. deletion of the last NS record will silently be ignored by bind at least, returning NOERROR.

from bind log: keyname: updating zone 'mydomain.tld/IN': attempt to delete last NS ignored

i think as long as the provider logic ensures that new NS records are created before old ones are deleted while applying this may be usable, possibly by adding a warning in the documentation about this.