Skip to content

Commit 3b5328a

Browse files
committed
Another take
1 parent 34bec09 commit 3b5328a

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

operations/deployment/terraform/aws/bitovi_main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,13 @@ module "aws_route53_ecs" {
522522
aws_r53_root_domain_deploy = var.aws_r53_root_domain_deploy
523523
aws_r53_enable_cert = var.aws_r53_enable_cert
524524
# ELB
525-
aws_elb_dns_name = try(module.aws_ecs[0].load_balancer_dns,"")
526-
aws_elb_zone_id = try(module.aws_ecs[0].load_balancer_zone_id,"")
525+
aws_elb_dns_name = module.aws_ecs[0].load_balancer_dns #try(module.aws_ecs[0].load_balancer_dns,"")
526+
aws_elb_zone_id = module.aws_ecs[0].load_balancer_zone_id #try(module.aws_ecs[0].load_balancer_zone_id,"")
527527
# Certs
528528
aws_certificates_selected_arn = var.aws_r53_enable_cert && var.aws_r53_domain_name != "" ? module.aws_certificates[0].selected_arn : ""
529529
# Others
530530
fqdn_provided = local.fqdn_provided
531-
depends_on = [ module.aws_certificates,module.aws_ecs ]
531+
#depends_on = [ module.aws_certificates,module.aws_ecs ]
532532
providers = {
533533
aws = aws.r53
534534
}

operations/deployment/terraform/modules/aws/route53/aws_route53.tf

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,6 @@ data "aws_route53_zone" "selected" {
33
private_zone = false
44
}
55

6-
locals {
7-
aws_elb_zone_id = var.aws_elb_zone_id
8-
}
9-
10-
#data "aws_route53_records" "dev" {
11-
# zone_id = data.aws_route53_zone.selected.zone_id
12-
# name_regex = "${var.aws_r53_sub_domain_name}.${var.aws_r53_domain_name}"
13-
#}
14-
#
15-
#resource "aws_route53_record" "dev" {
16-
# count = var.fqdn_provided ? (var.aws_r53_root_domain_deploy ? 0 : 1) : 0
17-
# zone_id = data.aws_route53_zone.selected.zone_id
18-
# name = "${var.aws_r53_sub_domain_name}.${var.aws_r53_domain_name}"
19-
# type = "A"
20-
#
21-
# alias {
22-
# name = var.aws_elb_dns_name
23-
# zone_id = data.aws_route53_records.dev.resource_record_sets.alias_target[0].zone_id != var.aws_elb_zone_id ? var.aws_elb_zone_id : data.aws_route53_records.dev.resource_record_sets.alias_target[0].zone_id
24-
# #zone_id = var.aws_elb_zone_id # <-- This is different!
25-
# evaluate_target_health = true
26-
# }
27-
#}
28-
29-
data "aws_route53_records" "existing_dev" {
30-
zone_id = data.aws_route53_zone.selected.zone_id
31-
name_regex = "${var.aws_r53_sub_domain_name}.${var.aws_r53_domain_name}"
32-
}
33-
34-
# Or if you really need to check existing records, make it safer:
35-
locals {
36-
existing_zone_id = try(data.aws_route53_records.existing_dev.resource_record_sets[0].alias_target.hosted_zone_id) != "" ? data.aws_route53_records.existing_dev.resource_record_sets[0].alias_target.hosted_zone_id : var.aws_elb_zone_id
37-
}
38-
396
resource "aws_route53_record" "dev" {
407
count = var.fqdn_provided ? (var.aws_r53_root_domain_deploy ? 0 : 1) : 0
418
zone_id = data.aws_route53_zone.selected.zone_id
@@ -44,7 +11,7 @@ resource "aws_route53_record" "dev" {
4411

4512
alias {
4613
name = var.aws_elb_dns_name
47-
zone_id = local.existing_zone_id
14+
zone_id = var.aws_elb_zone_id
4815
evaluate_target_health = true
4916
}
5017
}

0 commit comments

Comments
 (0)