Cloudflare Enablement
Cloudflare Zero Trust
Testing
Edit this page on GitHub
Set theme to dark (⇧+D)

Terraform

Requirements
Terraform installed on your machine
The Cloudflare provider properly configured

Terraform is a tool for building, changing, and versioning infrastructure, and provides components and documentation for building Cloudflare resources . Listed below are examples to help you get started with building Access with Terraform. For a more generalized guide on configuring Cloudflare and Terraform, visit our Getting Started with Terraform and Cloudflare blog post.

​​ Create an application with Terraform

  1. Create an application.

    Here is an example configuration:

  2. Next, we need to export our environment variables and secrets:

  3. Now we can run a terraform plan which will output any proposed changes. Make sure to review the plan carefully:

  4. Apply these changes using the apply command, once they look accurate and you’re comfortable moving forward:

​​ Create a policy

After you’ve created an application, you can start creating policies and attaching them to applications:

To do so:

  1. Run a terraform plan:

  2. Next, apply these changes using the apply command, once they look accurate and you’re comfortable moving forward:

​​ Configuring an identity provider

The example below shows how you can configure an identity provider and attach it to a policy:

These are the basics to get up and running with Access and Terraform. Refer to our API documentation for other endpoints that can be managed via Terraform.