I am creating a Elastic Beanstalk application, and I will have multiple environments (STAGING, PROD).
For my production environment, I want to point my domain name to the Load balancer that my EB creates. How can I do this?
So my DNS would be like:
resource "aws_route53_record" "naked" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "naked"
type = "A"
alias {
zone_id = "${aws_route53_record.www.zone_id}"
evaluate_target_health = true
}
}
resource "aws_route53_record" "www" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "www"
type = "A"
alias {
name = ""
zone_id = ""
evaluate_target_health = true
}
}
But for the "www" record, how do I get the Load balancer name/zone_id from the EB?
resource "aws_elastic_beanstalk_application" "app_web" {
name = "EB-${var.prefix}-${var.app_web}"
}
resource "aws_elastic_beanstalk_environment" "app-prod" {
.....
}