terraform { required_providers { hammerhead = { source = "veillax/hammerhead" } } } # HAMMERHEAD_URL, HAMMERHEAD_TOKEN (a server key, for edges) and HAMMERHEAD_ORG come from the environment. provider "hammerhead" {} resource "hammerhead_edge" "fra" { name = "fra" tunnel_addr = "203.0.113.5:51820" } resource "hammerhead_site" "home" { name = "home" tags = ["lab"] } resource "hammerhead_domain" "example" { name = "example.com" edge_id = hammerhead_edge.fra.id } resource "hammerhead_port" "web" { name = "web" proto = "https" edge_id = hammerhead_edge.fra.id port = 443 hostname = "app.${hammerhead_domain.example.name}" redirect_http = true health_path = "/healthz" auth_sso = true target { site_id = hammerhead_site.home.id host = "192.168.1.30" port = 8080 } rule { action = "allow" match = "path" value = "/public" } } resource "hammerhead_port" "minecraft" { name = "minecraft" proto = "tcp" edge_id = hammerhead_edge.fra.id port = 25565 target { site_id = hammerhead_site.home.id host = "192.168.1.31" port = 25565 } } variable "ops_webhook" { type = string sensitive = true } resource "hammerhead_alert_channel" "ops" { name = "ops" kind = "webhook" format = "slack" target = var.ops_webhook } # Hand these to the Bamboo and Blacktip programs. output "site_token" { value = hammerhead_site.home.token sensitive = true } output "edge_token" { value = hammerhead_edge.fra.token sensitive = true }