hhctl CLI and Terraform provider for Hammerhead

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
VeillaxandClaude Sonnet 5.5 committed 2026-10-27 17:02:15 -06:00
commit bf340cdab4
19 files changed
+2442

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
# Stand up an edge, a site, a domain and a web port with hhctl.
# Needs HAMMERHEAD_URL and HAMMERHEAD_TOKEN (a server key) in the environment.
set -eu
hhctl edges create --name fra --tunnel 203.0.113.5:51820
hhctl sites create --name home --tag lab
hhctl domains add --name example.com --edge fra
hhctl ports create --name web --proto https --edge fra --port 443 \
--hostname app.example.com --target home:192.168.1.30:8080
hhctl ports list
+81
View File
@@ -0,0 +1,81 @@
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
}