cloudflare/r2-custom-domain v0.1.0
Two module changes for LIB-0051 ยง2, so a site workload can serve its R2 bucket on its host and deploy to it with a token scoped to that bucket.
New: cloudflare/r2-custom-domain
- What it is. One
cloudflare_r2_custom_domain: an R2 bucket served on one hostname of a Cloudflare zone. - The zone is looked up by its apex (
zone), asdns-recorddoes, so a leaf needs no zone ID. - The bucket is addressed in R2's
eujurisdiction, where every family bucket is (LIB-0006). There's no input to change it. domainmust be the zone's apex or a name under it.- The other inputs:
enableddefaults totrue, andmin_tlsto1.2. - Outputs:
domainandzone_id.
module "custom_domain" {
source = "https://noisypigeon.garden/terraform/cloudflare/r2-custom-domain/v0.1.0"
account_id = local.cloudflare_account_id
zone = "example.com"
bucket_name = "example.com"
domain = "example.com"
}
cloudflare/api-token: policies can name R2 buckets
- The new resource. A policy can name
r2_buckets(bucket names,eujurisdiction) as its one resource, instead ofzones,all_zonesoraccount. Its permission groups resolve at the R2 bucket scope. For example,{ permission_groups = ["Workers R2 Storage Bucket Item Write"], r2_buckets = ["example.com"] }writes one bucket's objects. - New outputs
s3_access_key_idands3_secret_access_key(sensitive) sign in to R2's S3 API as the token: its ID, and the SHA-256 of its value. - Existing callers change nothing:
r2_bucketsdefaults to empty.
Generated by Claude Code
PR: https://github.com/noisypigeon/runway/pull/165