You can create Cloud Connector rules using the Terraform Cloudflare provider ↗ .
To get started with Terraform for Cloudflare configuration, refer to Terraform: Get started .
The following example Terraform configuration creates Cloud Connector rules for various supported providers to route traffic between them based on URI paths:
resource "cloudflare_cloud_connector_rules" "cloud_connector_rules" {
description = "Route /data to GCP bucket"
expression = "(http.request.uri.path wildcard \" */data/* \" )"
host = "mystorage.storage.googleapis.com"
description = "Route /resources to AWS bucket"
expression = "(http.request.uri.path wildcard \" */resources/* \" )"
host = "mystorage.s3.ams.amazonaws.com"
description = "Route /files to Azure bucket"
expression = "(http.request.uri.path wildcard \" */files/* \" )"
provider = "azure_storage"
host = "mystorage.blob.core.windows.net"
description = "Route /images to R2 bucket"
expression = "(http.request.uri.path wildcard \" */images/* \" )"
provider = "cloudflare_r2"
host = "mybucketcustomdomain.example.com"
Refer to the Terraform Cloudflare provider documentation ↗ for more information on the cloudflare_cloud_connector_rules
resource.
Thank you for helping improve Cloudflare's documentation!