Terraform Provider v5 Migration, Breaking Changes and Issue Fixes
What breaks in Terraform provider v5, which resources changed, and how closed issues address drift, Workers, and Zero Trust.
This page summarizes Cloudflare release notes for the official Terraform provider major version v5: documented breaking changes, recurring plan/apply drift, and issues closed across provider releases. It is aimed at operators who upgraded from v4, see unexpected terraform plan output, or manage Workers, Zero Trust, rulesets, and zone resources as code.
Provider v5 breaking changes: which Terraform resources need migration
Section titled “Provider v5 breaking changes: which Terraform resources need migration”Provider v5 introduces breaking schema and behavior changes on a fixed set of API-backed resources. Cloudflare documents them in multiple changelog entries with the same list and points readers to migration instructions in the provider documentation (linked from those entries, not repeated here).
The following resources have breaking changes. See the v5 Migration Guide ↗︎ for detailed migration instructions.
abusereports
acm.totaltls
apigateway.configurations
cloudforceone.threatevents
d1.database
intel.indicatorfeeds
logpush.edge
origintlsclientauth.hostnames
queues.consumers
radar.bgp
rulesets.rules
schemavalidation.schemas
snippets
zerotrust.dlp
zerotrust.networks— Cloudflare, Changelog
The same breaking-change notice appears on core platform, developer platform, fundamentals, and Terraform product changelog pages. Treat any stack that still manages the resources above with v4-style blocks as a migration candidate before you rely on a clean plan.
v4 to v5 upgrade failures: state and schema errors
Section titled “v4 to v5 upgrade failures: state and schema errors”A common blocker during upgrade is Terraform being unable to reshape existing state to the new provider schema. Cloudflare closed issue #5738, described as: v4 to v5 upgrade failing with Error: no schema available and Unable to Read Previously Saved State for UpgradeResourceState. That class of failure means you should not force-apply until state upgrade and provider pin are aligned with the v5.9 release notes and later entries that reference the same fix set in the Terraform changelog hub.
Terraform plan always shows changes: idempotency and drift fixes
Section titled “Terraform plan always shows changes: idempotency and drift fixes”Many v5 issues are not “wrong Terraform config” but non-idempotent reads: the provider rewrites or mis-compares API values so every plan proposes updates.
If you have an unaddressed issue with the provider, we encourage you to check the open issues ↗︎ and open a new issue if one does not already exist for what you are experiencing.
— Cloudflare, Terraform v5.9 now available
Resources that often showed false drift (and related fixes)
Section titled “Resources that often showed false drift (and related fixes)”Symptom in terraform plan |
Resource / area | Issue (closed per changelog) |
|---|---|---|
| Updates every apply with no real change | cloudflare_zero_trust_access_policy |
#5565 — breaks idempotency |
Unexpected .app_count on apply (5.5.0) |
cloudflare_zero_trust_access_policy |
#5608 — v5.7.0 |
| OTP pin login churn | cloudflare_zero_trust_access_identity_provider |
#5693, #5532 |
| Access app never settles | cloudflare_zero_trust_access_application |
#5904 not idempotent; #5770 type warp diff |
| API token always drifts | cloudflare_api_token |
#5548 |
| Log push job perpetual diff | cloudflare_logpush_job |
#5578 |
| Zone-level surprise drift | cloudflare_zone |
#5891 suddenly started showing drift |
| List items recreated as “created” (5.4.0+) | cloudflare_list_item |
#5552 |
| Zero Trust list always marked for change | cloudflare_zero_trust_list |
#5882 read-only attributes |
| Gateway policy recurring change after v5 | cloudflare_zero_trust_gateway_policy |
#5839; import filter #5304 — v5.5.0 |
Zone setting editable inconsistent |
cloudflare_zone_setting |
#5795; value vs enabled confusion #5653 |
| DNSSEC apply HTTP 400 | cloudflare_zone_dnssec |
#5765 Malformed request body |
Common conclusion: If your resource appears in this table and you are on an older 5.x pin, upgrading the provider to the release that closed the issue (cited in the linked changelog post) is the documented remediation path. If drift persists afterward, the changelog text directs you to open provider issues rather than silently ignoring plan output.
cloudflare_workers_script: deploy, bindings, and Durable Objects
Section titled “cloudflare_workers_script: deploy, bindings, and Durable Objects”Workers script issues cluster around content/bindings ignored, per-apply diffs, destroy failures, and Durable Object migrations not recorded in tfstate.
| Problem | Issue | Noted in |
|---|---|---|
secret_text env replaced every deploy |
#5892 | v5.9 |
| Durable Object migrations not applied | #5898 | v5.9 |
| DO migrations not in tfstate; can’t upgrade versions | #5701 | v5.8.4 |
Ignoring content and bindings (v5.2.0) |
#5439 | v5.8.2 |
| Always detects changes after apply | #5522 | v5.8.2 |
| With bindings fails to destroy | #5634 | v5.8.2 |
| Unable to deploy worker assets | #5616 | v5.8.2 |
Random deploy failure when changing compatibility_date |
#5704 | v5.8.2 |
| 500 when uploading Python | #5331 | v5.8.2 |
After upgrading the provider, re-run plan and confirm whether diffs are limited to intentional changes (for example compatibility_date) rather than full script replacement.
Rulesets, WAF, and DNS: plan surprises beyond drift
Section titled “Rulesets, WAF, and DNS: plan surprises beyond drift”cloudflare_ruleset: rule removal and cache bypass mismatch
Section titled “cloudflare_ruleset: rule removal and cache bypass mismatch”Removing one rule in cloudflare_ruleset could recreate later rules (#5921), which is destructive in production rule ordering. Separately, http_request_cache_settings bypass could disagree between dashboard and Terraform (#5727). Example docs listing read-only id was corrected (#5666). These fixes are listed in v5.9 and v5.8.2.
Managed WAF rules could not be managed via Terraform (#5755); confirm current provider support before modeling managed rulesets only in HCL.
DNS and page rules
Section titled “DNS and page rules”cloudflare_dns_records was reported as always updated in-place (#5858). Page rules had import gaps (#5303), redirect creation failures (#5178), and a panic when modifying the resource (#5577) — see v5.5.0 and v5.6.0.
Zero Trust Access and tunnels: policy and tunnel Terraform errors
Section titled “Zero Trust Access and tunnels: policy and tunnel Terraform errors”Access applications and policies
Section titled “Access applications and policies”| Issue | Meaning for operators |
|---|---|
| #5811 | Reusable policies imported as inline type on cloudflare_zero_trust_access_application |
| #5529 | Self-hosted apps with private IPs require public domain |
| #5662 | cloudflare_zero_trust_access_policy does not support OIDC claims (capability gap called out in changelog) |
| #5612 | data.cloudflare_zero_trust_access_applications does not exact match |
| #5789 | Pagination in cloudflare_zero_trust_access_policies data source |
Gateway certificate resource could not be marked active/inactive (#5879). Device profile resources lacked import or DNS server limits (#5526, #5569) per v5.6.0.
cloudflared tunnel resources
Section titled “cloudflared tunnel resources”Tunnel-related closures include 500 on zero_trust_tunnel_cloudflared_virtual_network (#5098), serialization failures on cloudflare_zero_trust_tunnel_cloudflared_config (#5508), crashes when optional fields are null on tunnel resources (#5524), and inability to rotate tunnel secret (#5561). Treat null optional blocks as omitted rather than explicit null until your provider version includes #5524 fixes.
Snippets, lists, and ancillary resources
Section titled “Snippets, lists, and ancillary resources”cloudflare_snippets:Uncaught Error: No such module(#5017) — v5.8.4.cloudflare_argo_smart_routing: import did not read actual value (#5640).cloudflare_turnstile_widget: not able to update (#5336) — v5.5.0.cloudflare_zone_setting: invalidalways_use_httpsvalue (#5423).cloudflare_account_member: invalid typestringfor fieldroles(#5700).cloudflare_logpull_retention: missing import (#5563) — v5.7.0.
snippets also appears in the v5 breaking changes list, so snippet workflows may need both migration and runtime module fixes.
Provider release cadence: where to read closed issues
Section titled “Provider release cadence: where to read closed issues”Cloudflare publishes Terraform provider fixes both on numbered changelog indexes (for example 44, 45, 46, 47, 48, 49) and on version posts such as v5.5.0, v5.6.0, v5.7.0, v5.8.2, v5.8.4, and v5.9. The issue numbers are GitHub provider tickets; the changelog is the authoritative “fixed in release” index Cloudflare maintains on developers.cloudflare.com.
Common mistakes when interpreting v5 changelogs
Section titled “Common mistakes when interpreting v5 changelogs”- Treating every post-apply diff as user error instead of checking whether a closed issue matches the resource type.
- Importing Access or Gateway policies without verifying import attribute mapping (#5304, #5811).
- Editing ruleset lists in Terraform without accounting for rule recreation on delete (#5921).
- Setting read-only fields (for example ruleset
idin examples — #5666) in module code copied from older examples. - Leaving optional tunnel or profile fields as
nullinstead of omitting blocks (#5524).
How to check this on your site
Section titled “How to check this on your site”-
Record your current provider version from your Terraform configuration and confirm it against the version named in the relevant post (for example Terraform v5.9 now available).
-
Run
terraform planin a safe workspace and map unexpected changes to issue numbers in the Terraform product changelog. -
For breaking-change resources (for example
rulesets.rules,snippets,zerotrust.dlp), compare your modules to the breaking-change list in Changelog before apply. -
If behavior still matches an open regression, follow Cloudflare’s guidance to check open provider issues and file a new one if needed, as stated in the v5.9 release notes.
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are questioning so it can be corrected or explained.