Automating Cloudflare Tunnel with Terraform
May 14, 2021Chris De La Garza

Summary
This post introduces the automation of Cloudflare Tunnel creation and management using Terraform. It details how Named Tunnels and their associated API endpoints, combined with Terraform's `cloudflare_argo_tunnel` resource and `templatefile` function, allow for the dynamic provisioning of tunnels and their configuration on origin servers. The example demonstrates setting up a tunnel to proxy traffic to a Google Compute Engine instance running HTTPbin and SSH, with Zero Trust policies applied to SSH access.