hashicorp / terraform-provider-dyn

Terraform Dyn provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://registry.terraform.io
Mozilla Public License 2.0
7 stars 16 forks source link

check for existing record before trying to update #32

Open fawaf opened 6 years ago

fawaf commented 6 years ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "dyn_record" "tld_route53" {
  zone  = "${var.zone}"
  name  = "${var.dns_name}"
  value = "blah.com."
  type  = "NS"

  depends_on = ["aws_route53_zone.main"]
}

Expected Behavior

What should have happened? since the record is already there, nothing.

Actual Behavior

What actually happened? terraform tries to update the record and dyn returns an error.

* dyn_record.tld_route53.2: Failed to create Dyn record: server responded with 400 Bad Request: {"status": "failure", "data": {}, "job_id": 419626952, "msgs": [{"INFO": "make: Cannot duplicate existing record data", "SOURCE": "DYN", "ERR_CD": "TARGET_EXISTS", "LVL": "ERROR"}, {"INFO": "add: Record not added", "SOURCE": "BLL", "ERR_CD": null, "LVL": "INFO"}]}

Steps to Reproduce

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

  1. terraform apply