Route53 Record set error

2,803 views
Skip to first unread message

Máté Gulyás

unread,
Jul 2, 2015, 3:28:47 AM7/2/15
to terrafo...@googlegroups.com
Hi all,

I encountered an error with adding a record to route53. I create an elb with name redirecter-prod-redirecter-test, and I try to add it to route53 as an alias.
I changed the zoneID, but I have it the same way, fixed. 

resource "aws_route53_record" "redirecter-test" {
  zone_id = "Z1DV0ZFF4AVYLA"
  type = "A"

  alias {
    zone_id =  "${aws_elb.redirecter-prod-redirecter-test.zone_id}"
    evaluate_target_health = true
  }
}

The error I got: 
===================
[....]
aws_route53_record.redirecter-test: Creating...
  alias.#:                                "" => "1"
  alias.620579030.evaluate_target_health: "" => "1"
  alias.620579030.name:                   "" => "redirecter-prod-redirecter-test"
  alias.620579030.zone_id:                "" => "Z3DZXE0Q79N41H"
  fqdn:                                   "" => "<computed>"
  name:                                   "" => "redirect-test.enbritely.co.uk"
  type:                                   "" => "A"
  zone_id:                                "" => "Z1DV0ZFF4AVYLA"
aws_route53_record.redirecter-test: Error: 1 error(s) occurred:

* InvalidChangeBatch: Tried to create an alias that targets redirect-test.enbritely.co.uk., type A in zone Z3DZXE0Q79N41H, but the alias target name does not lie within the target zone
        status code: 400, request id: [8dc74333-208a-11e5-9d2d-d5f90ef2f018]
Error applying plan:

1 error(s) occurred:

* InvalidChangeBatch: Tried to create an alias that targets redirect-test.enbritely.co.uk., type A in zone Z3DZXE0Q79N41H, but the alias target name does not lie within the target zone
        status code: 400, request id: [8dc74333-208a-11e5-9d2d-d5f90ef2f018]
===================

Terraform version: 0.6 (OS: Fedore 22)

I verified that I can do it on AWS console, I can add the recordset with the same parameters. The strange thing is that the error message seems off. In the part "type A in zone Z3DZXE0Q79N41H" the zoneid is the zoneid of the ELB not the hosted zone where I try to add the A record. 
Any ideas what am I missing?

Thanks in advance,
Mate



Máté Gulyás

unread,
Jul 3, 2015, 5:32:36 AM7/3/15
to terrafo...@googlegroups.com
The error was due to a missconfiguration. The terraform documentation is correct, I was inattentive.
The name should be dns_name.

>>>>>
  alias {
<<<<<  >>>>>
  alias {
    name = "${aws_elb.redirecter-prod-redirecter-test.dns_name}"
<<<<<


Mate
Reply all
Reply to author
Forward
0 new messages