No description
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| terraform | ||
| .gitignore | ||
| docker-compose.yml | ||
| README.md | ||
Example Terraform Cloudflare Tunnel
This repo contains a quick path to setting up a cloudflare tunnel and cloudflared using terraform/open-tofu and docker-compose respectively.
NOTE: docker is totally not required for cloudflared - you can just run the binary
Cloudflare Tunnel
Setup a Cloudflare tunnel with terraform/open-tofu. The example uses a local state file, which isn't ideal for actual use. I use remote state with my self-hosted minio to store terraform state.
terraform {
required_version = ">= 1.0"
# uncomment and fill out if you want to use remote s3 backend for state storage
# backend "s3" {
# endpoint = "https://s3.example.com"
# bucket = "infrastructure-state"
# key = "my-cloudflare-tunnel/terraform.tfstate"
# region = "us-east-1"
# # copy paste from my homelab setup,
# # access_key = "ACCESSKEY"
# # secret_key = "SECRETKEY"
# skip_credentials_validation = true
# skip_metadata_api_check = true
# use_path_style = true
# }
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}
Cloudflared
TUNNEL_TOKEN=$(tofu output -raw tunnel_token) docker compose up -d