Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tofu/modules/pages-web/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ resource "github_actions_secret" "cloudflare_api_token" {
plaintext_value = cloudflare_account_token.pages_deploy.value
}

// R2's REST object API rejects bucket-scoped tokens, so the basemap goes up through the S3 API.
// Its credentials are derived from the token: the id is the access key and the SHA-256 of the
// value is the secret.
resource "github_actions_secret" "r2_access_key_id" {
repository = var.repository
secret_name = "R2_ACCESS_KEY_ID"
plaintext_value = cloudflare_account_token.pages_deploy.id
}

resource "github_actions_secret" "r2_secret_access_key" {
repository = var.repository
secret_name = "R2_SECRET_ACCESS_KEY"
plaintext_value = sha256(cloudflare_account_token.pages_deploy.value)
}

resource "github_actions_variable" "cloudflare_account_id" {
repository = var.repository
variable_name = "CLOUDFLARE_ACCOUNT_ID"
Expand Down