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

dns_a_record_set cannot create A record entries when a matching wildcard CNAME record exist #90

Open jvshahid opened 5 years ago

jvshahid commented 5 years ago

Terraform Version

Affected Resource(s)

Terraform Configuration Files

# Configure the DNS Provider
provider "dns" {
  update {
    server        = "${local.master_dns_ip}"
    key_name      = "rndc-key."
    key_algorithm = "hmac-md5"
    key_secret    = "${local.bind_rndc_secret}"
  }
}

resource "dns_a_record_set" "ldap_a_record" {
  zone      = "${local.dns_zone_name}."
  name      = "ldap"
  addresses = ["${module.bootstrap.public_ips}"]
  ttl       = 300
}

Debug Output

https://gist.github.com/jvshahid/70be63c8a1271873d039472df8132549

Steps to Reproduce

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

  1. Run terraform apply to create the A record resource state
  2. Remove the A record out of band, e.g. by recreating the bind server.
  3. Add a wildcard CName DNS entry in the same bind server, e.g. *.${local.dns_zone_name}
  4. Run terraform apply

Expected Behavior

The last terraform apply notices the missing A record and creates it.

Actual Behavior

The last step terraform apply fails with the following error:

Error: Error refreshing state: 1 error(s) occurred:

* dns_a_record_set.ldap_a_record: 1 error(s) occurred:

* dns_a_record_set.ldap_a_record: dns_a_record_set.ldap_a_record: Error querying DNS record: didn't get a A record

Important Factoids

We are using a bind server.

/cc @Logiraptor

bodgit commented 5 years ago

Can you capture the DNS traffic as a pcap?

KarthikRangaraju commented 4 years ago

+1 Running into the same issue

puppetmaster commented 4 years ago

+1 me to