Skip to content

Commit fdde815

Browse files
committed
CCM-11586: more sensible route53 config
1 parent 94e1215 commit fdde815

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed
Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
resource "aws_api_gateway_domain_name" "main" {
2+
count = var.manually_configure_mtls_truststore ? 1 : 0
23
regional_certificate_arn = aws_acm_certificate_validation.main.certificate_arn
34
domain_name = local.root_domain_name
45
security_policy = "TLS_1_2"
@@ -17,26 +18,28 @@ resource "aws_api_gateway_domain_name" "main" {
1718
}
1819

1920
lifecycle {
20-
ignore_changes = var.manually_configure_mtls_truststore ? [mutual_tls_authentication] : []
21+
ignore_changes = [
22+
mutual_tls_authentication
23+
]
2124
}
2225
}
2326

24-
# resource "aws_api_gateway_domain_name" "main_nonprod" {
25-
# count = var.manually_configure_mtls_truststore ? 1 : 0
26-
# regional_certificate_arn = aws_acm_certificate_validation.main.certificate_arn
27-
# domain_name = local.root_domain_name
28-
# security_policy = "TLS_1_2"
29-
30-
# endpoint_configuration {
31-
# types = ["REGIONAL"]
32-
# }
33-
34-
# depends_on = [
35-
# aws_s3_bucket.truststore
36-
# ]
37-
38-
# mutual_tls_authentication {
39-
# truststore_uri = "s3://${aws_s3_bucket.truststore.id}/${aws_s3_object.placeholder_truststore_nonprod[0].id}"
40-
# truststore_version = aws_s3_object.placeholder_truststore_nonprod[0].version_id
41-
# }
42-
# }
27+
resource "aws_api_gateway_domain_name" "main_nonprod" {
28+
count = !var.manually_configure_mtls_truststore ? 1 : 0
29+
regional_certificate_arn = aws_acm_certificate_validation.main.certificate_arn
30+
domain_name = local.root_domain_name
31+
security_policy = "TLS_1_2"
32+
33+
endpoint_configuration {
34+
types = ["REGIONAL"]
35+
}
36+
37+
depends_on = [
38+
aws_s3_bucket.truststore
39+
]
40+
41+
mutual_tls_authentication {
42+
truststore_uri = "s3://${aws_s3_bucket.truststore.id}/${aws_s3_object.placeholder_truststore_nonprod[0].id}"
43+
truststore_version = aws_s3_object.placeholder_truststore_nonprod[0].version_id
44+
}
45+
}

infrastructure/terraform/components/api/route53_record.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ resource "aws_route53_record" "main" {
44
zone_id = local.root_domain_id
55

66
alias {
7-
name = aws_api_gateway_domain_name.main.regional_domain_name
8-
zone_id = aws_api_gateway_domain_name.main.regional_zone_id
7+
name = var.manually_configure_mtls_truststore ? aws_api_gateway_domain_name.main.0.regional_domain_name : aws_api_gateway_domain_name.main_nonprod.0.regional_domain_name
8+
zone_id = var.manually_configure_mtls_truststore ? aws_api_gateway_domain_name.main.0.regional_zone_id : aws_api_gateway_domain_name.main_nonprod.0.regional_zone_id
99

1010
evaluate_target_health = true
1111
}

0 commit comments

Comments
 (0)