diff --git a/main.tf b/main.tf index 22a2ba8..6f65506 100644 --- a/main.tf +++ b/main.tf @@ -81,6 +81,7 @@ locals { full_account_name = "${var.env == "live" ? "${var.aws_account_alias}prod" : "${var.aws_account_alias}dev"}" backend_dns_domain = "${local.full_account_name}.${var.backend_dns}" backend_dns_record = "${local.logical_service_name}.${local.backend_dns_domain}" + simple_backend_dns_record = "${local.env_prefix}${replace(var.component_name, "/-service$/", "")}.${local.backend_dns_domain}" } data "aws_route53_zone" "dns_domain" { @@ -89,7 +90,7 @@ data "aws_route53_zone" "dns_domain" { resource "aws_route53_record" "dns_record" { zone_id = data.aws_route53_zone.dns_domain.zone_id - name = local.backend_dns_record + name = var.simple_dns_name ? local.simple_backend_dns_record : local.backend_dns_record type = "CNAME" records = [var.alb_dns_name] diff --git a/test/test_tf_backend_service_routing.py b/test/test_tf_backend_service_routing.py index 0466884..0cff79e 100644 --- a/test/test_tf_backend_service_routing.py +++ b/test/test_tf_backend_service_routing.py @@ -247,6 +247,7 @@ def test_create_aws_alb_target_group(self): + resource "aws_alb_target_group" "target_group" { + arn = (known after apply) + arn_suffix = (known after apply) + + connection_termination = false + deregistration_delay = "10" + id = (known after apply) + lambda_multi_value_headers_enabled = false diff --git a/variables.tf b/variables.tf index 02e4861..cd9d22a 100644 --- a/variables.tf +++ b/variables.tf @@ -128,3 +128,9 @@ variable "extra_listener_http_header_pairs" { })) default = [] } + +variable "simple_dns_name" { + description = "simplify the name of route53 dns in live env" + type = bool + default = false +} \ No newline at end of file