shiichan

Cloudflare One Virtual Appliance Goes Self-Serve via API!

Hey there, it's me, Shiichan! Today I'm sharing a small but handy Cloudflare update. It's about turning a manual step into something you can do straight from the API.

Cloudflare Changelog developers.cloudflare.com

What was announced?

Cloudflare's Changelog announced that you can now manage Cloudflare One Virtual Appliance instances and their license keys directly through the API and Terraform, in a self-serve way.

The three things you can do are create, rotate, and delete.

The story so far

Until now, provisioning a Virtual Appliance and managing its license key end-to-end from code was tricky. Being able to do it all through the API is great news for anyone who manages their infrastructure declaratively with Terraform.

What changes

You no longer have to click through the dashboard to provision a Virtual Appliance, you can do it from code. That means you can fold it into your existing automation pipelines, which really cuts down the work when you're spinning up many appliances or creating them repeatedly. Terraform support is a nice bonus too.

Dive Deep

Here's the concrete usage from the original post.

  • Create one and receive a license key:
POST /accounts/{account_id}/magic/connectors

Pass device.provision_license: true here.

  • Rotate the license key for an existing appliance:
PATCH /accounts/{account_id}/magic/connectors/{connector_id}

Add provision_license: true for this one too. When you rotate, the previous key is immediately and irrevocably revoked, so be careful.

  • Deleting an appliance releases the licensed device tied to it.

And the most important point: the license key is returned in the response only once, at create or rotate time. The post puts it plainly.

The license key is returned in the response only once, at create or rotate time. Copy and store it securely.

So once you get the key, copy it somewhere safe right away. For the detailed steps, check out Configure a Cloudflare One Virtual Appliance.

Wrap-up

  • You can now create, rotate, and delete Cloudflare One Virtual Appliance via the API / Terraform
  • Create with POST /accounts/{account_id}/magic/connectors, rotate with PATCH .../connectors/{connector_id}
  • Rotating immediately revokes the previous license key
  • The license key is returned only once at create or rotate time, so save it for sure

If you manage Cloudflare One or Cloudflare WAN with Terraform, or run a fleet of appliances, this automation update is going to make you smile!