Skip to content

Commit

Permalink
Setup DNS records for test helpers on digital ocean
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Sep 24, 2024
1 parent 2f74d5d commit 9f8e638
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions tf/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ module "ooni_th_droplet" {
"3d:81:99:17:b5:d1:20:a5:fe:2b:14:96:67:93:d6:34",
"f6:4b:8b:e2:0e:d2:97:c5:45:5c:07:a6:fe:54:60:0e"
]
dns_zone_ooni_io = local.dns_zone_ooni_io
}

module "ooni_backendproxy" {
Expand Down
10 changes: 10 additions & 0 deletions tf/modules/ooni_th_droplet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ resource "digitalocean_droplet" "ooni_th_docker" {
create_before_destroy = true
}
}
resource "aws_route53_record" "ooni_th" {
zone_id = var.dns_zone_ooni_io
name = "${each.key}.do.th.${var.stage}.ooni.io"
type = "A"
ttl = 300
for_each = {
for d in digitalocean_droplet.ooni_th_docker : reverse(split("-", d.name))[0] => d.ipv4_address
}
records = [each.value]
}
4 changes: 4 additions & 0 deletions tf/modules/ooni_th_droplet/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
output "droplet_ipv4_address" {
value = digitalocean_droplet.ooni_th[*].ipv4_address
}

output "droplet_addresses" {
value = aws_route53_record.ooni_th[*].fqdn
}
4 changes: 4 additions & 0 deletions tf/modules/ooni_th_droplet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ variable "deployer_key" {
variable "metrics_password" {
type = string
}

variable "dns_zone_ooni_io" {
type = string
}

0 comments on commit 9f8e638

Please sign in to comment.