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

CNAME records fail to update upon parameter change #53

Open moskey71 opened 6 years ago

moskey71 commented 6 years ago

Terraform Version

Terraform v0.11.8

Affected Resource(s)

Terraform Configuration Files

provider "dns" {
update {
server = "1.2.3.4"
}
}

resource "dns_cname_record" "pilot-record" {
zone = "myzone.com."
name = "myname"
cname = "internal-lb.amazonaws.com."
ttl = 300
}

Expected Behavior

Terraform should re-create or update the record upon the cname parameter being changed.

Actual Behavior

dns_cname_record.pilot-record: 1 error(s) occurred: dns_cname_record.pilot-record: DNS record differs

Steps to Reproduce

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

  1. terraform apply
  2. Change the cname parameter in the "dns_cname_record" resource.
  3. 'terraform apply`

For a workaround, I'm using terraform destroy -target "dns_cname_record.pilot-record" and then terraform apply

Should the DNS provider be able to re-create or update the CNAME record, or is the actual behavior expected?

bodgit commented 6 years ago

Can you build this provider from source against master and try and reproduce? The error message has gone now as part of adding resource import functionality and so I don't think it should error now.

The behaviour should be that it updates the CNAME correctly.

moskey71 commented 6 years ago

@bodgit Will do. I should get to it next week

bodgit commented 6 years ago

I had a further look at the changes I made and I think there is a test that specifically creates a CNAME record then changes its value and checks that it gets updated correctly, which matches your use case. If it does work as I expect then I think you just need to nag somebody at Hashicorp to make a new release of this provider.

moskey71 commented 5 years ago

Really late reply by me, but I wanted to document that I tested this built with the source and saw the same behavior. However, if I run terraform apply again, it is successful.