diff --git a/deploy/aws/tf/modules/alb/main.tf b/deploy/aws/tf/modules/alb/main.tf index 81a07406..cd40084f 100644 --- a/deploy/aws/tf/modules/alb/main.tf +++ b/deploy/aws/tf/modules/alb/main.tf @@ -50,5 +50,23 @@ resource "aws_lb_listener" "https" { target_group_arn = aws_lb_target_group.app_tg.arn } - depends_on = [aws_lb_target_group.app_tg] + depends_on = [aws_lb_target_group.app_tg, data.aws_acm_certificate.domain_cert] +} + +data "aws_route53_zone" "chapter" { + name = "chapter.show" +} + +resource "aws_route53_record" "api_chapter_show" { + zone_id = data.aws_route53_zone.chapter.zone_id + name = "api.chapter.show" + type = "A" + + alias { + name = aws_lb.app_alb.dns_name + zone_id = aws_lb.app_alb.zone_id + evaluate_target_health = true + } + + depends_on = [data.aws_route53_zone.chapter] }