Skip to content

Instantly share code, notes, and snippets.

@istarkov
Created July 5, 2023 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save istarkov/9431c0897063cf5120817e69bfc7a8aa to your computer and use it in GitHub Desktop.
Save istarkov/9431c0897063cf5120817e69bfc7a8aa to your computer and use it in GitHub Desktop.
// Intent to test n8n endpoints locally
resource "random_id" "playground_tunnel_secret" {
byte_length = 35
}
resource "cloudflare_tunnel" "playground" {
provider = cloudflare.main
account_id = local.cloudflare_account_id
name = "playground"
secret = random_id.playground_tunnel_secret.b64_std
}
resource "cloudflare_record" "playground" {
provider = cloudflare.main
name = "wstd-sys-playground"
zone_id = data.cloudflare_zone.wstd_work.zone_id
value = "${cloudflare_tunnel.playground.id}.cfargotunnel.com"
type = "CNAME"
proxied = true
}
output "tunnel_token" {
value = <<-EOT
Execute locally
cloudflared tunnel --no-autoupdate --url localhost:8787 run --token ${nonsensitive(cloudflare_tunnel.playground.tunnel_token)}
then access through wstd-sys-playground.wstd.work to localhost:8787
EOT
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment