Skip to content

Commit

Permalink
Add support for passing th domains into rules
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Sep 17, 2024
1 parent 835f8fe commit ac0001c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tf/environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ module "ooniapi_frontend" {
"8.th.dev.ooni.io" : local.dns_zone_ooni_io
}

oonith_domains = ["8.th.dev.ooni.io"]

stage = local.environment
dns_zone_ooni_io = local.dns_zone_ooni_io

Expand Down
19 changes: 19 additions & 0 deletions tf/modules/ooniapi_frontend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ resource "aws_alb_listener" "ooniapi_listener_https" {
tags = var.tags
}

resource "aws_alb_listener_rule" "ooniapi_th" {
listener_arn = aws_alb_listener.ooniapi_listener_https.arn
priority = 90

action {
type = "forward"
target_group_arn = var.oonibackend_proxy_target_group_arn
}

condition {
host_header {
values = var.oonith_domains
}
}

tags = var.tags
}


resource "aws_lb_listener_rule" "ooniapi_oonirun_rule" {
listener_arn = aws_alb_listener.ooniapi_listener_https.arn
priority = 100
Expand Down
5 changes: 5 additions & 0 deletions tf/modules/ooniapi_frontend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ variable "alternative_domains" {
description = "map of alternate names for the frontend as a map from domain to zone id"
default = {}
}

variable "oonith_domains" {
type = list(string)
default = ["*.th.dev.ooni.io"]
}

0 comments on commit ac0001c

Please sign in to comment.