terraform-provider-dns icon indicating copy to clipboard operation
terraform-provider-dns copied to clipboard

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

Open jvshahid opened this issue 5 years ago • 3 comments

Terraform Version

  • Terraform v0.11.13
  • Tested with DNS provider version 2.2.0

Affected Resource(s)

  • dns_a_record_set

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

jvshahid avatar Aug 09 '19 14:08 jvshahid

Can you capture the DNS traffic as a pcap?

bodgit avatar Oct 09 '19 14:10 bodgit

+1 Running into the same issue

KarthikRangaraju avatar Mar 02 '20 21:03 KarthikRangaraju

+1 me to

puppetmaster avatar Jul 22 '20 13:07 puppetmaster