Abstract


  • A company that offers services that cover these topics

Install the Cloudflare Cli

Make sure you have Go installed and configured. For more information, refer to cloudflare cli· GitHub

go install github.com/cloudflare/cloudflare-go/cmd/flarectl@latest
 
# Set the API_Token
$ export CF_API_TOKEN=Abc123Xyz

Debugging authentication errors

Common casuses:

  • Using zone-scoped token for account-scoped resource.
  • Token missing account-level Access: Apps & Policies (Edit) scope.
  • Accidentally passing empty application_id.

Zone

  • A single DNS zone like yxy.ninja
  • API permissions required: API token must have Zone-scoped rights for that domain like “Zone → DNS: Edit”

Terraform Cloudflare zone-level resources

  • cloudflare_dns_record
  • cloudflare_page_rule
  • cloudflare_workers_route

Account

  • Entire Cloudflare account (can span many zones)
  • Permissions required: API token must have Account-scoped rights

Terraform Cloudflare account-level resources

  • cloudflare_zero_trust_access_application
  • cloudflare_zero_trust_access_policy
  • cloudflare_account_member
  • cloudflare_workers_script

When used: Features not bound to a single zone but to your Zero Trust / account-wide config.

In the new Zero Trust model, all Access / Gateway / Tunnel resources are account-scoped. That’s why you had to switch from zone_id → account_id.