shiichan

Cloudflare CASB integrations can now be managed with Terraform

Hi everyone, it's Shii-chan! Today I found a Cloudflare update that lets you manage CASB with Terraform, so let me walk you through it!

Cloudflare Changelog developers.cloudflare.com

What was announced?

In the Cloudflare Changelog, Cloudflare announced that you can now create Cloudflare CASB integrations with the Cloudflare Terraform provider. Supported integrations can be managed as infrastructure-as-code alongside the rest of your setup.

The story so far

Until now, CASB integrations were mainly set up through the dashboard and similar manual routes. That left a manual step outside the resources you already manage in Terraform.

What changes

You can write CASB integrations as code, review them, and then apply them. If you want your security configuration to follow the same workflow as the rest of your infrastructure, this is good news!

Dive Deep

The example in the original post creates a Google Cloud Platform integration.

resource "cloudflare_zero_trust_casb_integration" "google_cloud_platform" {
  account_id = var.cloudflare_account_id
  name       = "Google Cloud Platform"
  paused     = false

  google_cloud_platform = {
    google_cloud_platform_service_account = {
      service_account_key_json = file("service-account-key.json")
    }
  }
}

Here are the conditions to keep in mind:

  • The cloudflare_zero_trust_casb_integration resource requires provider version 5.27.0 or later
  • Version 4 of the provider is not supported
  • Integrations that use OAuth are not supported

Setup instructions and integration guides are in the Cloudflare docs under "Cloud and SaaS integrations".

Wrap-up

  • CASB integrations can now be created with the Cloudflare Terraform provider
  • Provider 5.27.0 or later is required (version 4 is not supported)
  • OAuth-based integrations are out of scope

This is for security and infrastructure folks who already manage Cloudflare Zero Trust with Terraform!