diff --git a/terraform/compute.tf b/terraform/compute.tf index aae5407..5dbe68d 100644 --- a/terraform/compute.tf +++ b/terraform/compute.tf @@ -30,3 +30,37 @@ module "standalone_ec2" { tags = var.tags } + +module "zones" { + source = "terraform-aws-modules/route53/aws//modules/zones" + version = "~> 2.0" + + zones = { + "clientapp.com" = { + comment = "Public facing ALB name." + } + } + + tags = var.tags +} + +module "records" { + source = "terraform-aws-modules/route53/aws//modules/records" + version = "~> 2.0" + + zone_name = keys(module.zones.route53_zone_zone_id)[0] + + records = [ + { + name = "clientapp.com" + type = "A" + alias = { + name = module.loadbalancer.lb_dns_name + zone_id = module.loadbalancer.lb_zone_id + evaluate_target_health = true + } + } + ] + + depends_on = [module.zones, module.loadbalancer] +} \ No newline at end of file