Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Terraform Provider v5: OpenAPI Generation, v4 Migration, and Resource Stability

What Cloudflare’s Terraform v5 provider changes, how to migrate from v4, and how drift detection and release cadence affect your plans.

This page summarises Cloudflare developer documentation on the Cloudflare Terraform Provider v5: why it was rewritten, what breaks when you upgrade from v4, how Cloudflare is stabilising resources, and which fixes (drift detection, sensitive redaction, migration tooling) matter in daily terraform plan workflows. Tutorial steps for zone HTTPS settings assume the v5 SDK.

Terraform Provider v5: what changed from earlier providers

Section titled “Terraform Provider v5: what changed from earlier providers”

Cloudflare’s v5 provider is a ground-up rewrite aimed at managing the platform through GitOps with broader API coverage.

Cloudflare’s v5 Terraform Provider is now generally available. With this release, Terraform resources are now automatically generated based on OpenAPI Schemas. This change brings alignment across our SDKs, API documentation, and now Terraform Provider. The new provider boosts coverage by increasing support for API properties to 100%, adding 25% more resources, and more than 200 additional data sources.

— Cloudflare, Terraform v5 Provider is now generally available

Unlike hand-written earlier providers, v5 tracks the REST API via OpenAPI. That alignment helps new Cloudflare APIs surface in Terraform faster, but it also explains early post-launch churn: generation can expose schema or behaviour gaps until each resource is hardened.

Unlike the earlier Terraform providers, v5 is automatically generated based on the OpenAPI Schemas for our REST APIs. Since launch, we have seen an unexpectedly high number of issues reported by customers. These issues currently impact about 15% of resources.

— Cloudflare, Terraform v5.6.0 now available

The same announcement notes breaking changes for some resource types and points operators to Cloudflare’s upgrade guide (linked from the GA post).

v4 to v5 migration: tf-migrate, state upgraders, and deprecated tools

Section titled “v4 to v5 migration: tf-migrate, state upgraders, and deprecated tools”

Teams moving state from v4 ask how to rename resources, update attributes, and avoid risky manual state surgery. Cloudflare has been shipping migration affordances in provider releases rather than only documenting one-shot steps.

Terraform Provider v5.19.0 introduces 14 new resources spanning AI Gateway, Pipelines, R2 Data Catalog, User Groups, Vulnerability Scanner, Workers Observability, and Zero Trust capabilities. This release significantly improves the v4 to v5 migration experience with automatic state upgraders for 26 resources, working seamlessly with the new tf-migrate CLI tool to automate resource renames, attribute updates, and moved block generation. Together, these enhancements reduce manual migration effort and minimize risk when upgrading from v4 to v5.

— Cloudflare, Terraform v5.19.0 now available

For CLI-based migrations, prefer tf-migrate over the older path:

Note: cmd/migrate is deprecated in favor of tf-migrate and will be removed in a future release (#7062 ↗︎)

— Cloudflare, Terraform v5.19.0 now available

Broader migration tooling is also on Cloudflare’s public roadmap: recurring changelog posts state that the most-used resources are targeted for stability by the end of March 2026, with a new migration tool planned around that timeline to ease v4→v5 moves (see Terraform v5.17.0 now available).

Resource renames you may hit during migration

Section titled “Resource renames you may hit during migration”

Watch for renamed Terraform resources in changelog notes, not only attribute diffs. For example, v5.9 documents a Snippets resource change:

This release includes a new resource, cloudflare_snippet, which replaces cloudflare_snippets.

— Cloudflare, Terraform v5.9 now available

Adopt the replacement resource name in configuration and let tf-migrate or state upgraders handle moves where supported.

IP Lists item order and Terraform noise (v4 line)

Section titled “IP Lists item order and Terraform noise (v4 line)”

If you still run v4 for WAF IP Lists, item order changes from API implementation can make Terraform think state drifted. Cloudflare’s WAF historical note recommends resyncing state or using provider 4.44.0 or later on the v4 line—separate from v5 migration but relevant when plan shows unexpected list changes (Historical (2024)).

Resource stability: release cadence and the resource-per-resource model

Section titled “Resource stability: release cadence and the resource-per-resource model”

After GA, Cloudflare committed to frequent patch releases focused on reliability and migration compatibility.

We have committed to releasing improvements on a 2-3 week cadence to ensure its stability and reliability, including the v5.14 release. We have also pivoted from an issue-to-issue approach to a resource-per-resource approach - we will be focusing on specific resources to not only stabilize the resource but also ensure it is migration-friendly for those migrating from v4 to v5.

— Cloudflare, Terraform v5.14.0 now available

Later posts describe a growing list of resources marked stable, with high-traffic resources on track for stability by end of March 2026 (Terraform v5.17.0 now available). v5.8.4 adds test-driven stabilization for heavily used APIs:

One key change we adopted in recent weeks is a pivot to more comprehensive, test-driven development. … As a result, you will see several of the highest traffic APIs have been stabilized in the most recent release, and are supported by comprehensive acceptance tests.

— Cloudflare, Terraform v5.8.4 now available

Concern What Cloudflare documents Practical takeaway
Release frequency Every 2–3 weeks (v5.20.0) Pin provider version in production; read changelog before bumping
Stabilization scope Resource-per-resource; “stable” list growing Prefer stable resources for critical paths; file issues for blockers
Issue volume ~13.5–15% of resources impacted at various points (v5.7.0, v5.6.0) Expect some resources to need newer patch versions
Latest feature drops e.g. v5.20.0 adds 24 resources, cloudflare-go v7 (changelog) Upgrade when you need new resources or migration fixes

Track ongoing releases on the Terraform changelog product page.

Drift detection: when terraform plan falsely wanted replacement

Section titled “Drift detection: when terraform plan falsely wanted replacement”

A common v5 pain point was plan proposing updates or replacements although remote configuration matched code. Cloudflare fixed drift detection for many resources from provider 5.2.0 upward.

In Cloudflare Terraform Provider versions 5.2.0 and above, dozens of resources now have proper drift detection. Before this fix, these resources would indicate they needed to be updated or replaced — even if there was no real change. Now, you can rely on your terraform plan to only show what resources are expected to change.

— Cloudflare, Dozens of Cloudflare Terraform Provider resources now have proper drift detection

Affected areas named in that post include DNS, SSL/TLS, Workers, Zero Trust, Rules, R2, Pages, Bot Management, and others. If you still see phantom diffs on an old 5.0.x pin, upgrading to ≥ 5.2.0 is the documented remedy.

Sensitive values in Terraform logs: OpenAPI x-sensitive

Section titled “Sensitive values in Terraform logs: OpenAPI x-sensitive”

Security reviews often ask whether API tokens or secrets appear in CI logs during terraform apply. From 5.2.0 onward, sensitive schema fields should redact in command output because OpenAPI marks them.

In the Cloudflare Terraform Provider versions 5.2.0 and above, sensitive properties of resources are redacted in logs. Sensitive properties in Cloudflare’s OpenAPI Schema are now annotated with x-sensitive: true. This results in proper auto-generation of the corresponding Terraform resources, and prevents sensitive values from being shown when you run Terraform commands.

— Cloudflare, Cloudflare Terraform Provider now properly redacts sensitive values

Products called out include Tunnels, TLS Certs and Hostnames, Workers, Turnstile, Magic WAN, and DLP. You should still follow least-privilege API tokens; redaction reduces accidental exposure in logs, not mis-scoped credentials.

Managing Cloudflare with Terraform v5 in tutorials and products

Section titled “Managing Cloudflare with Terraform v5 in tutorials and products”

Zone HTTPS and performance tutorials (v5 snippets only)

Section titled “Zone HTTPS and performance tutorials (v5 snippets only)”

Cloudflare’s Terraform tutorial sequence uses v5-only examples after DNS basics. HTTPS tutorial prerequisites include prior tutorials and a valid origin certificate (for strict SSL); code refers to the v5 SDK only (Configure HTTPS settings). The load-balancing tutorial similarly requires tutorials 1–3 and Load Balancing on the account (Improve performance / load balancing).

Typical flow: DNS records → zone TLS settings (TLS 1.3, Automatic HTTPS Rewrites, Strict SSL mode) → optional load balancing—always with a pinned v5 provider version matching the tutorial era.

WAN operators can manage tunnels and routes with v5 resources:

The Cloudflare Terraform provider resources for Cloudflare WAN tunnels and routes now support Terraform provider version 5. Customers using infrastructure-as-code workflows can manage their tunnel and route configuration with the latest provider version.

— Cloudflare, Terraform V5 support for tunnels and routes

Common mistakes when adopting Terraform Provider v5

Section titled “Common mistakes when adopting Terraform Provider v5”
  • Jumping to v5 without reading breaking-change scope for each resource in use (GA announcement).
  • Using cmd/migrate after v5.19.0 instead of tf-migrate.
  • Staying below 5.2.0 while blaming “Terraform drift” for forced replacements (drift fix).
  • Floating ~> 5.0 to latest weekly in production without reading the Terraform changelog.
  • Ignoring renamed resources (for example Snippets) during state moves (v5.9).
  • Assuming early-access SDK policy equals GA provider stability—Cloudflare’s SDK ecosystem support policy warns that early-access SDKs are often unsuitable for production unless explicitly stated; still pin and test the Terraform provider on your own resources.
  1. In your Terraform root module, confirm the cloudflare provider requirement matches a documented v5 release you intend to use (compare with Terraform v5.20.0 now available or the Terraform changelog hub).
  2. Run terraform plan against a non-production workspace and verify changes match intentional edits—not blanket replacements on DNS, SSL/TLS, Workers, or Zero Trust resources (drift behaviour described in resource force-replacement fix).
  3. If migrating from v4, dry-run tf-migrate and provider state upgraders per Terraform v5.19.0 before applying to production state.
  4. Re-run plan after upgrade to ≥ 5.2.0 and confirm sensitive fields redact in CI logs (sensitive values redaction).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.