n3integration/terraform-provider-godaddy

Error: diffs didn't match during apply

byt3bl33d3r opened this issue · 2 comments

Hi,

While using your provider I encountered this error. It does say it's a bug in TF itself but thought you might be interested as well in case you've never encountered it (or if you think it might be a bug in the provider).

Error: Error applying plan:

1 error(s) occurred:

* module.a_record.godaddy_domain_record.a_record[0]: godaddy_domain_record.a_record.0: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Please include the following information in your report:

    Terraform Version: 0.10.8
    Resource ID: godaddy_domain_record.a_record.0
    Mismatch reason: attribute mismatch: record.551216760.data
    Diff One (usually from plan): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{"record.551216760.data":*terraform.ResourceAttrDiff{Old:"@", New:"@", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.4070433664.ttl":*terraform.ResourceAttrDiff{Old:"600", New:"0", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.~1785577371.ttl":*terraform.ResourceAttrDiff{Old:"", New:"600", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.551216760.ttl":*terraform.ResourceAttrDiff{Old:"600", New:"600", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.~1785577371.data":*terraform.ResourceAttrDiff{Old:"", New:"${element(var.ips, count.index)}", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.~1785577371.type":*terraform.ResourceAttrDiff{Old:"", New:"A", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.4070433664.name":*terraform.ResourceAttrDiff{Old:"@", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.4070433664.data":*terraform.ResourceAttrDiff{Old:"<ip_address_censored>", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.551216760.type":*terraform.ResourceAttrDiff{Old:"CNAME", New:"CNAME", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.~1785577371.name":*terraform.ResourceAttrDiff{Old:"", New:"@", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.551216760.name":*terraform.ResourceAttrDiff{Old:"www", New:"www", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "record.4070433664.type":*terraform.ResourceAttrDiff{Old:"A", New:"", NewComputed:false, NewRemoved:true, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}
    Diff Two (usually from apply): *terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff(nil), Destroy:false, DestroyDeposed:false, DestroyTainted:false, Meta:map[string]interface {}(nil)}

Also include as much context as you can about your config, state, and the steps you performed to trigger this error.

I'm calling the provider from a module, and using the count parameter to create multiple records:

Contents of the modules main.tf:

terraform {
  required_version = ">= 0.10.0"
}

resource "godaddy_domain_record" "a_record" {
  count = "${var.count}"
  domain   = "${element(var.domains, count.index)}"

  record {
    name = "@"
    type = "A"
    data = "${element(var.ips, count.index)}"
    ttl = 600
  }

  record {
    name = "www"
    type = "CNAME"
    data = "@"
    ttl = 600
  }

  nameservers = "${var.nameservers}"
}

Contents of the modules variables.tf:

variable "count" {
  default = 1
}

variable "domains" {
  type = "list"
}

variable "ips" {
  type = "list"
}

variable "nameservers" {
  type = "list"
  default = ["ns11.domaincontrol.com", "ns12.domaincontrol.com"]
}

Contents of the module's outputs.tf:

output "records" {
  value = "${zipmap(var.domains, var.ips)}"
}

This is how I'm calling the actual module:

module "a_record" {
  source = "./modules/godaddy/a-record"

  count = 2
  domains = ["domain1.com", "domain2.com"]
  ips = "${module.http_rdir.ips}"
}

Cheers

Hey @byt3bl33d3r - Thanks for reporting. I'll see if I can reproduce this locally.

unable to recreate; closing issue....