Cloudflare Terraform Provider: Managing Cloudflare with Terraform
Cloudflare Terraform Provider
At a glance
- What is it?
- cloudflare/terraform-provider-cloudflare is a Go-based Terraform provider for managing Cloudflare resources through the Cloudflare REST API. It requires Terraform CLI 1.0 or later, supports API tokens and environment variables, and is generated and maintained internally by Cloudflare.
- Who is it for?
- This provider suits teams that want Cloudflare configuration represented in Terraform and can operate within its generated, internally maintained model. It is less suitable for contributors who need to submit directly supported provider changes through GitHub.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 16 days ago.
- What is it written in?
- Mainly Go, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 7, 2026, and from our analysis. They are not legal advice.
Star history
- cloudflare/terraform-provider-cloudflare1,353 ★ · +9
| Repository | 2026-10-17 | 2026-11-07 |
|---|---|---|
| cloudflare/terraform-provider-cloudflare | 1.3k | 1.4k |
9 Stars in the last 21 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Cloudflare REST API access from Terraform
cloudflare/terraform-provider-cloudflare solves a configuration problem for infrastructure teams: expressing Cloudflare settings as Terraform-managed resources instead of changing the Cloudflare dashboard manually. Its stated purpose is convenient access to the Cloudflare REST API from Terraform. The repository is a Terraform provider, not a separate Cloudflare control panel. Terraform reads configuration files, initializes the provider, and applies operations through the provider to Cloudflare resources such as zones. The README example creates a `cloudflare_zone` resource named `example_zone`, with an account ID, domain name, and zone type. This makes the provider relevant to teams that manage DNS zones and other Cloudflare configuration alongside infrastructure code. The README does not enumerate every resource or data source, so adoption should begin by checking the Terraform Registry documentation and the repository's `examples/resources` directory. The provider is written in Go. Its `go.mod` lists dependencies on `github.com/hashicorp/terraform-plugin-sdk/v2`, `github.com/hashicorp/terraform-plugin-framework`, and several Cloudflare Go client versions, indicating that the repository contains a compiled Terraform integration rather than a collection of shell scripts.
Provider configuration and authentication boundaries
The provider accepts account-scoped and zone-scoped identifiers separately. The documented environment variables are `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_API_KEY`, `CLOUDFLARE_EMAIL`, `CLOUDFLARE_API_USER_SERVICE_KEY`, `CLOUDFLARE_ACCOUNT_ID`, and `CLOUDFLARE_ZONE_ID`. The README recommends API tokens as the preferred authorization scheme. It describes `api_key` and `api_email` as the previous authorization scheme, while `user_service_key` is documented as a key used with the Origin CA certificates API. Because these values carry credentials or identify Cloudflare objects, the README recommends environment variables for sensitive values. The provider block can contain either explicit settings or environment-backed values. The documentation does not say that every option is required in every use case. Instead, the table marks all listed options as not required, which may reflect conditional use by particular resources, although the README does not define those conditions. It also does not document token scope requirements. That omission matters because a Terraform plan may appear valid while the API rejects operations when the token lacks the permissions or account context needed for a specific Cloudflare resource.
Installing the provider and running the first zone configuration
The documented installation requirement is Terraform CLI 1.0 or later. The provider itself is obtained through Terraform's provider registry rather than by compiling the Go repository. A first configuration should declare the `cloudflare/cloudflare` source, select a version, configure authentication, and declare one Cloudflare resource. The README shows the version constraint `~> 5.28.0`. The example credentials are illustrative values and should not be used in a real account. Replace them with a token or the documented environment variables.
After creating the Terraform configuration, run the initialization command in the directory containing it:
terraform initThe README says this initializes the provider. The command resolves the provider selected by the `required_providers` declaration; it does not itself apply the zone resource. The next practical step would be to use Terraform's normal apply workflow, although the README does not include an apply command. The repository's `examples/provider`, `examples/resources`, and `examples/data-sources` directories contain additional examples, while the Terraform Registry provides the full documentation. A first real use should therefore begin with the zone example only if the account ID and domain are correct for the target Cloudflare account.
How a Terraform apply reaches Cloudflare
The visible architecture has three main layers. Terraform CLI parses the configuration and resolves the provider version. The provider then uses Cloudflare API client packages listed in `go.mod` to communicate with the Cloudflare REST API. The resulting Terraform state records the managed resource configuration and identifiers returned through the provider. The `go.mod` file includes multiple `cloudflare-go` modules, including `github.com/cloudflare/cloudflare-go`, `github.com/cloudflare/cloudflare-go/v6`, and `github.com/cloudflare/cloudflare-go/v7`, as well as Terraform plugin framework and SDK packages. That dependency list suggests that different parts of the provider may use different Terraform plugin or API client generations. It does not establish a user-visible data flow beyond the documented Terraform-to-API relationship, so the exact internal path for each resource should be checked in its Registry documentation. The README does not describe retries, timeouts, rate-limit handling, partial failures, import behavior, or state migration behavior. It also does not describe how changes to a resource outside Terraform are detected. Those are important boundaries for teams that use the provider as the sole source of truth for production Cloudflare settings.
Version constraints and maintenance limits
The provider's versioning follows SemVer conventions according to the README, but the project explicitly allows some backward-incompatible changes in minor releases. The documented exceptions involve library internals that are technically public but not intended or documented for external use, and changes that the project does not expect to affect most users. This means a minor version should not automatically be treated as a low-risk upgrade without reviewing its documentation and changelog. The repository includes `CHANGELOG.md`, `RELEASING.md`, `release-please-config.json`, and `.release-please-manifest.json`, which are concrete files for checking release and upgrade information. The repository is not archived, and the last push was on 2026-10-13, with recent releases listed for v5.26.0, v5.27.0, and v5.28.0. At the same time, the README says the provider is auto-generated and maintained internally at Cloudflare. It says community pull requests are no longer accepted, although a pull request with a known fix can still serve as a reference implementation and should be accompanied by an issue. This maintenance model affects upgrade planning more than basic use: teams need to follow Cloudflare's releases and check generated documentation, but they cannot expect a normal community contribution path.
License, comparison, and adoption limits
The repository uses the Apache-2.0 license. That identifies the project's published license, but teams still need to review license notices and their own compliance obligations when distributing or embedding code. A real alternative is to manage Cloudflare directly through the Cloudflare REST API with a general-purpose Terraform provider that supports HTTP operations, or with a small internal automation program. That approach avoids adding Cloudflare-specific resource schemas, but it also requires the team to implement authentication, request construction, response parsing, error handling, state tracking, and retries itself. The Cloudflare provider takes on those provider-specific concerns and exposes Cloudflare configuration through Terraform resources. It is therefore the clearer choice when its documented resources match the desired management model, and the wrong choice when the required API behavior is absent from the provider or when a team needs direct, fine-grained control over requests. The README does not document a complete resource matrix, import procedure, rollback procedure, retry policy, or migration guide. It also does not promise protection against manual changes made in the Cloudflare dashboard. Before choosing it, compare the required Cloudflare operations with the Registry's resource and data source documentation rather than relying on the provider name alone.
Editorial conclusion
This provider suits teams that want Cloudflare configuration represented in Terraform and can operate within its generated, internally maintained model. It is less suitable for contributors who need to submit directly supported provider changes through GitHub. Before adoption, verify the Terraform CLI version, the intended provider version, authentication method, required account or zone identifiers, and whether the relevant resource is covered by the provider documentation.
Frequently asked questions
What is cloudflare/terraform-provider-cloudflare used for?
It provides Terraform access to the Cloudflare REST API. The README shows managing a Cloudflare zone through a `cloudflare_zone` resource.
What are the requirements for using cloudflare/terraform-provider-cloudflare?
The provider requires Terraform CLI 1.0 or later. It also needs suitable Cloudflare authorization and, depending on the operation, an account ID or zone ID.
How do I initialize the Cloudflare Terraform provider?
Add a `required_providers` entry for `cloudflare/cloudflare` and run `terraform init` in the directory containing the Terraform configuration. The README documents the initialization command but does not provide a separate provider installation command.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/cloudflare-terraform-provider-cloudflare)Star history chart for your README
[](https://hysenlabs.com/projects/cloudflare-terraform-provider-cloudflare)Was this useful?