How to setup R2 bucket custom domain and CORS policy?

I’m using Terraform to propagate my CF infrastructure, but REST api is also fine.

I can’t find the way to setup Custom Domains for R2 buckets via api. According to https://developers.cloudflare.com/api/operations/r2-create-bucket accepts only:

  • Location
  • Bucket name
  • Account ID

I can’t find other API that allows to do this. Is the only way of archiving it is going through CF dashboard manually?