Skip to content

Commit

Permalink
Fix cert validation when FQDN is inside of other zone
Browse files Browse the repository at this point in the history
* Add 6.th.ooni.org to list of th addresses
  • Loading branch information
hellais committed Sep 24, 2024
1 parent 93ee8dd commit 9d7b8ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tf/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,10 @@ module "ooniapi_frontend" {
alternative_domains = {
"api.ooni.org" : local.dns_root_zone_ooni_org
"5.th.ooni.org" : local.dns_root_zone_ooni_org,
"6.th.ooni.org" : local.dns_root_zone_ooni_org,
}

oonith_domains = ["5.th.ooni.org"]
oonith_domains = ["5.th.ooni.org", "6.th.ooni.org"]

stage = local.environment
dns_zone_ooni_io = local.dns_zone_ooni_io
Expand Down
11 changes: 6 additions & 5 deletions tf/modules/ooniapi_acm_certificate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "aws_acm_certificate" "this" {

tags = var.tags

subject_alternative_names = [for domain_name, zone_id in var.alternative_domains : domain_name]
subject_alternative_names = keys(var.alternative_domains)

lifecycle {
create_before_destroy = true
Expand All @@ -40,9 +40,10 @@ resource "aws_acm_certificate" "this" {
resource "aws_route53_record" "cert_validation" {
for_each = {
for dvo in aws_acm_certificate.this.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
domain_name = dvo.domain_name
}
}

Expand All @@ -51,7 +52,7 @@ resource "aws_route53_record" "cert_validation" {
records = [each.value.record]
ttl = 60
type = each.value.type
zone_id = var.main_domain_name_zone_id
zone_id = lookup(var.alternative_domains, each.value.domain_name, var.main_domain_name_zone_id)
}

resource "aws_acm_certificate_validation" "this" {
Expand Down

0 comments on commit 9d7b8ee

Please sign in to comment.