Skip to content

Commit 399669a

Browse files
committed
how about now
1 parent c5dee61 commit 399669a

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@ locals {
2626
# }
2727
#}
2828

29-
#data "aws_route53_records" "existing_dev" {
30-
# count = true ? 1 : 0
31-
# zone_id = data.aws_route53_zone.selected.zone_id
32-
# name_regex = "${var.aws_r53_sub_domain_name}.${var.aws_r53_domain_name}"
33-
#}
34-
#
35-
## Or if you really need to check existing records, make it safer:
36-
#locals {
37-
# existing_zone_id = try(
38-
# data.aws_route53_records.existing_dev[0].resource_record_sets[0].alias_target.zone_id,
39-
# var.aws_elb_zone_id
40-
# )
41-
#}
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.zone_id) != "" ? data.aws_route53_records.existing_dev.resource_record_sets[0].alias_target.zone_id : var.aws_elb_zone_id
37+
}
4238

4339
locals {
4440
existing_zone_id = var.aws_elb_zone_id

0 commit comments

Comments
 (0)