Route53 issue - not able to create a simple aws_route53_record with alias to an ELB

296 views
Skip to first unread message

Anuj Gupta

unread,
Mar 17, 2017, 9:26:04 AM3/17/17
to Terraform
Hi

I am not able to get a Route53 record set creation working via terraform. The Record Set needs to point to an ELB which is already created. I always get an 'Invalid Request' error. Here is a sample script:

data "aws_elb_hosted_zone_id" "main" { }

resource "aws_route53_record" "alias" {

count = "1"
zone_id = "${var.aws_route53_zone_id}"
name = "${var.env_name}"
type = "A"
set_identifier = "${var.env_name}"

alias {
name = "${aws_elb.elb.dns_name}"
zone_id = "${data.aws_elb_hosted_zone_id.main.id}"
evaluate_target_health = true
}
}

I was not earlier using the 'aws_elb_hosted_zone_id' data resource, 
but started using it after reading some online issues reported to ELB hosted zone id and the need to use some common AWS zone id depending on the AWS region.
Without data resource and using ELB zone id also, it gives the same error. I have also tried variation of adding 'dualstack' in front of ELB DNS name.

Just FYI, I am able to create the record via aws cli, but there I specify the Region param. I don't see any Region parameter for 'aws_route53_record'. 

Any clues would be really helpful, since I am stuck on this issue for many days.

Thanks
Anuj
Reply all
Reply to author
Forward
0 new messages