Skip to content

Take the R2 access key ID as an input, and drop r2-keys.sh - #28

Merged
benbirt merged 1 commit into
mainfrom
claude/no-r2-keys
Nov 29, 2026
Merged

benbirt merged 1 commit into
mainfrom
claude/no-r2-keys

Conversation

@benbirt

@benbirt benbirt commented Nov 29, 2026

Copy link
Copy Markdown
Owner

tofu.yml no longer runs tools/r2-keys.sh from the calling repository, so no repository needs to carry that script.

R2's S3 API takes an API token's ID as the access key ID and the token's SHA-256 as the secret. The script spent most of its length asking Cloudflare for the ID, which is fixed for the life of the token and not secret. So:

  • New required input r2_access_key_id: the ID of the token in CLOUDFLARE_API_TOKEN. The job exports it as AWS_ACCESS_KEY_ID.
  • One step exports the token's SHA-256 as AWS_SECRET_ACCESS_KEY, masked.
  • tools/r2-keys.sh is deleted here, and the Settings workflow passes this repository's token ID.

The ID is an input and not in the backend block because the S3 backend will not take access_key from configuration and the secret from the environment, and OpenTofu refuses a sensitive value in a backend block.

Breaking for callers when they move their pin: they must pass r2_access_key_id. eavesbard and benbirt.io have changes ready that do so and delete their copies of the script; they need this merged and tagged first. Callers on an earlier commit are unaffected.

Replacing a token now means changing its ID in each caller as well as the secret; the README says how to read the ID.

Checked locally: //github:github.plan with AWS_ACCESS_KEY_ID set to the ID and AWS_SECRET_ACCESS_KEY to the token's SHA-256 reports no changes. The Settings check on this pull request exercises the workflow itself.

README and comments were written by Neon and checked against the code.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@benbirt
benbirt merged commit 31ae04c into main Nov 29, 2026
2 checks passed
@benbirt
benbirt deleted the claude/no-r2-keys branch November 29, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant