CloudflareStatic-verified

Cache Rules for the Pages a Proxied Zone Does Not Cache

Cloudflare caches by file extension out of the box, so the hashed assets are cached and the HTML is not, and every page view still reaches the origin while the dashboard reports a healthy hit ratio. A rule that caches is what changes that; a ruleset holding none is refused, and a caching rule matching every request is refused separately.

terraformEdge & DNScloudflare

Compare CDN & Edge Delivery across clouds →

cloudflare-cdnvizier v1.2.0

Verification

Static-verified

Passed: validated and lint-clean (provider-schema-validated for AWS/Azure/GCP; Terraform-language lint elsewhere).

Conformance

  • Static validation (fmt · validate · tflint)
  • No applicable security policies for this provider
  • Plan tests (mocked: validation rules · outputs)

Provenance

  • SHA-256 checksum
  • Signature (pending)

Functional

  • Live test pending (no cloud run yet)

Last verified 2026-09-15 · how we verify

Use it from the registry

terraform · opentofu
module "cdn" {
  source  = "www.iac-bazaar.com/iac-bazaar/cloudflare-cdn/cloudflare"
  version = "1.0.0"
}

Needs a registry token from /account/tokens. The module itself is free; the account is what identifies you. Full setup: registry docs.

Inputs & outputs

Create a free account to read this module's contract

The declared contract - every input name, type, default and description, plus every output - is shown to signed-in accounts, not to anonymous visitors.

A free account sees the contract of every module in the catalogue. There is no subscription and nothing to buy - the modules are free to download, and they run under Vizier.

Documentation

cloudflare-cdn

Cache rules and zone cache settings on Cloudflare. Works with Terraform and OpenTofu (>= 1.6), cloudflare provider >= 5.0, < 6.0.

A proxied zone caches almost nothing by default. Cloudflare caches by file extension, so the hashed JavaScript is cached and the HTML is not, and every page view still reaches the origin while the dashboard reports a healthy hit ratio. A rule with cache = true is what changes that, and a ruleset holding none is refused.

edge_ttl_mode is the whole decision. respect_origin defers to the origin's Cache-Control - which means Cloudflare decides when the origin sends none, as an object store does. override_origin uses your number. origin_decides_ttl_refs lists the rules that took the first answer, so it is visible rather than assumed.

A caching rule whose expression is true will serve one visitor's page to the next. That exact combination is refused unless accepted by name.

The cache key decides who shares a copy. Keep every query string and anyone can miss the cache forever by appending a parameter; drop it entirely and ?page=2 serves page 1. cache_key_query_params is null, [], or the list of parameters that change the response.

Tiered Cache and Cache Reserve are managed in both directions, so turning one off here turns it off on the zone. A resource that is only created when the setting is wanted can never turn it back off. Cache Reserve is separately billed storage and says so before it will switch on.

Verification

Static validation runs tofu fmt, init, validate, tflint and checkov. This module has not yet had a live test, so it is published as statically validated with its live test pending and does not carry the live-tested mark.

Usage code & full reference need an account

The complete copy-paste usage, the full input/output reference, and operational notes are free with an account - shown here and bundled in the download. Sign in and this section fills in.

  • Usage

Related modules

Static validatedLive test pending

huawei-cdn

A Huawei Cloud CDN domain in front of your OBS bucket or origin host, serving outside mainland China unless an ICP-filed area is accepted by name, with the certificate from Cloud Certificate Manager, every HTTP request redirected, HSTS, HTTP/2, OCSP stapling, TLS 1.0 and 1.1 off, IPv6, cache headers followed from the origin, and the origin fetched over HTTPS. The CNAME is exported.

View module
Static validatedLive test pending

tencent-cdn

A Tencent Cloud CDN domain in front of your COS bucket or origin hosts, serving outside mainland China unless an ICP-filed area is accepted by name, with the certificate from SSL Certificate Service, every HTTP request redirected, HSTS, HTTP/2, OCSP stapling, TLS 1.0 and 1.1 off, IPv6, and the origin fetched over HTTPS. The CNAME to point the domain at is exported.

View module
Static validatedLive test pending

alicloud-cdn

An Alibaba Cloud CDN domain in front of your OSS bucket or origin host, serving outside mainland China unless an ICP-filed scope is accepted by name, with the certificate from Certificate Management, every HTTP request redirected, HSTS, HTTP/2, TLS 1.0 and 1.1 off, IPv6, and the origin fetched over HTTPS. The CNAME to point the domain at is exported.

View module
Static validatedLive test pending

do-cdn

A DigitalOcean CDN endpoint in front of a Spaces bucket, served on your domain with a DigitalOcean-managed certificate you name (the cdn.digitaloceanspaces.com name is accepted by name), with a cache TTL you chose. The CDN serves the bucket's public objects; a private object stays private through it.

View module
Static validatedLive test pending

akamai-property-ion

End-to-end Ion CDN property: origin, edge hostname, caching/performance rule tree, CP code, and staging/production activation.

View module
Static validatedLive test pending

scaleway-cdn

Edge Services is a chain of stages, each naming the one it forwards to, and every stage is content to exist naming nothing: a half-wired pipeline shows a name and a status in the console and answers no requests. This builds the whole chain, subscribes the plan without which nothing serves, and puts a certificate and your own domain in front of a bucket.

View module