blockstream-satellite-api/terraform/network-tor.tf

89 lines
2.3 KiB
Terraform
Raw Normal View History

2019-01-18 14:57:15 -08:00
resource "google_compute_global_address" "tor-lb" {
name = "${var.name}-lb"
2019-05-31 07:23:30 -07:00
project = var.project
count = local.create_misc
2019-01-18 14:57:15 -08:00
}
resource "google_compute_global_forwarding_rule" "tor-rule" {
name = "${var.name}-forwarding-rule"
2019-05-31 07:23:30 -07:00
target = google_compute_target_http_proxy.tor-proxy[0].self_link
2019-01-18 14:57:15 -08:00
port_range = "80"
ip_protocol = "TCP"
2019-05-31 07:23:30 -07:00
ip_address = google_compute_global_address.tor-lb[0].address
2019-01-18 14:57:15 -08:00
2019-05-31 07:23:30 -07:00
count = local.create_misc
2019-01-18 14:57:15 -08:00
}
resource "google_compute_target_http_proxy" "tor-proxy" {
name = "${var.name}-http-proxy"
2019-05-31 07:23:30 -07:00
url_map = google_compute_url_map.tor-proxy[0].self_link
2019-01-18 14:57:15 -08:00
2019-05-31 07:23:30 -07:00
count = local.create_misc
2019-01-18 14:57:15 -08:00
}
resource "google_compute_url_map" "tor-proxy" {
name = "${var.name}-urlmap"
2019-05-31 07:23:30 -07:00
default_service = google_compute_backend_bucket.tor_deadhole_backend[0].self_link
2019-01-18 14:57:15 -08:00
2019-05-31 07:23:30 -07:00
count = local.create_misc
2019-01-18 14:57:15 -08:00
host_rule {
hosts = ["*"]
path_matcher = "deadpaths"
}
path_matcher {
name = "deadpaths"
2019-05-31 07:23:30 -07:00
default_service = google_compute_backend_bucket.tor_deadhole_backend[0].self_link
2019-01-18 14:57:15 -08:00
path_rule {
paths = ["/*"]
2019-05-31 07:23:30 -07:00
service = google_compute_backend_bucket.tor_deadhole_backend[0].self_link
2019-01-18 14:57:15 -08:00
}
}
host_rule {
2019-05-31 07:23:30 -07:00
hosts = [var.onion_host]
2019-01-18 14:57:15 -08:00
path_matcher = "allpaths"
}
path_matcher {
name = "allpaths"
2021-09-02 10:35:20 -07:00
default_service = data.terraform_remote_state.blc-mainnet.outputs.lb_backend_service_tor
2019-01-18 14:57:15 -08:00
path_rule {
2019-03-11 16:50:04 -07:00
paths = ["/*"]
2021-09-02 10:35:20 -07:00
service = data.terraform_remote_state.blc-mainnet.outputs.lb_backend_service_tor
2019-01-18 14:57:15 -08:00
}
}
test {
2021-09-02 10:35:20 -07:00
service = data.terraform_remote_state.blc-mainnet.outputs.lb_backend_service_tor
2019-05-31 07:23:30 -07:00
host = var.onion_host
2019-03-07 12:29:43 -08:00
path = "/queue.html"
2019-01-18 14:57:15 -08:00
}
test {
2019-05-31 07:23:30 -07:00
service = google_compute_backend_bucket.tor_deadhole_backend[0].self_link
host = google_compute_global_address.tor-lb[0].address
2019-01-22 15:40:30 -08:00
path = "/*"
2019-01-18 14:57:15 -08:00
}
}
resource "google_compute_backend_bucket" "tor_deadhole_backend" {
name = "${var.name}-deadhole-backend-bucket"
description = "Unmatched hosts end up in this deadhole"
2019-05-31 07:23:30 -07:00
bucket_name = google_storage_bucket.tor_deadhole[0].name
2019-01-18 14:57:15 -08:00
enable_cdn = false
2019-05-31 07:23:30 -07:00
count = local.create_misc
2019-01-18 14:57:15 -08:00
}
resource "google_storage_bucket" "tor_deadhole" {
name = "${var.name}-deadhole-bucket"
location = "US"
2019-05-31 07:23:30 -07:00
count = local.create_misc
2019-01-18 14:57:15 -08:00
}
2019-05-31 07:23:30 -07:00