Skip to content

ZoneSetting

Source: src/Cloudflare/Zone/Setting.ts

A single Cloudflare zone setting (/zones/{zone_id}/settings/{settingId}) pinned to a desired value.

Zone settings are singletons — every setting always exists on every zone (with a Cloudflare default), so this resource never creates or deletes anything physical. Reconcile patches the setting when the observed value differs from the desired one; destroy restores the value the setting had before Alchemy first managed it (captured as initialValue).

Many settings are plan-gated (editable: false on lower plans — e.g. image_resizing, polish need Pro+; advanced_ddos is Enterprise). Patching a non-editable setting fails with Cloudflare’s “setting not editable” error.

Force HTTPS on the whole zone

yield* Cloudflare.ZoneSetting("AlwaysUseHttps", {
zoneId: zone.zoneId,
settingId: "always_use_https",
value: "on",
});

Disable Always Online

yield* Cloudflare.ZoneSetting("AlwaysOnline", {
zoneId: zone.zoneId,
settingId: "always_online",
value: "off",
});
yield* Cloudflare.ZoneSetting("BrowserCacheTtl", {
zoneId: zone.zoneId,
settingId: "browser_cache_ttl",
value: 3600,
});
yield* Cloudflare.ZoneSetting("MinTls", {
zoneId: zone.zoneId,
settingId: "min_tls_version",
value: "1.2",
});