Skip to content

Commit

Permalink
fix dns name issue
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed Jul 20, 2022
1 parent 8dad8c6 commit d9c5d28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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]
Expand Down
1 change: 1 addition & 0 deletions test/test_tf_backend_service_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit d9c5d28

Please sign in to comment.