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

[BUG] - TXT vultr_dns_record entries are modified on every plan/apply

Open mkeen opened this issue 4 years ago • 3 comments

Describe the bug When managing a vultr_dns_record of type TXT, running plan always indicates that the resource will be modified. My state is clean and the resource exists in vultr.

To Reproduce Terraform:

resource "vultr_dns_record" "spf" {
  domain = data.vultr_dns_domain.root_domain.id
  type   = "TXT"
  name   = ""
  ttl    = 86400
  data   = "v=spf1 mx -all"
}

No-op planned update: The data is indicating a change will be made, even if I apply it and then re-run plan.

  # vultr_dns_record.spf will be updated in-place
  ~ resource "vultr_dns_record" "spf" {
      ~ data     = "\"v=spf1 mx -all\"" -> "v=spf1 mx -all"
        id       = "f20ae138-4023-4af4-9a56-36dd530d6a5a"
        # (4 unchanged attributes hidden)
    }

Expected behavior I would expect that once the above TF is applied, a subsequent update would result in an empty plan (no resources to change)

Desktop (please complete the following information where applicable:

  • TF Cloud
  • TF Version: 1.0.3

mkeen avatar Jul 25 '21 19:07 mkeen

@mkeen to prevent the drift from happening for now is to do data = "\"v=spf1 mx -all\""

We'll take a look at the API + Terraform to see if we can resolve this

ddymko avatar Jul 26 '21 18:07 ddymko

Hey @mkeen

This is current API behavior where the TXT record needs to be enclosed in quotes. So the API is doing this for you which is why you are seeing the drift.

We are exploring some options to clean this up and make it a better experience.

ddymko avatar Jul 28 '21 13:07 ddymko

Thanks for the replies @ddymko. The suggested workaround is good 👍

mkeen avatar Jul 30 '21 00:07 mkeen