tf-infra/buckets.tf
Lander Van den Bulcke 96782c6cc4
feat: add r2 bucket for forgejo
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
2025-07-08 11:43:33 +02:00

50 lines
1.1 KiB
HCL

# Bucket for backups
resource "b2_bucket" "backups" {
bucket_name = "lvdb-backups"
bucket_type = "allPrivate"
}
# Application key for backups bucket
resource "b2_application_key" "restic" {
bucket_id = b2_bucket.backups.id
key_name = "restic"
capabilities = [
"deleteFiles",
"listAllBucketNames",
"listBuckets",
"listFiles",
"readBucketEncryption",
"readBucketReplications",
"readBuckets",
"readFiles",
"shareFiles",
"writeBucketEncryption",
"writeBucketReplications",
"writeFiles"
]
}
output "restic_application_key" {
value = b2_application_key.restic.application_key
sensitive = true
}
output "restic_application_key_id" {
value = b2_application_key.restic.application_key_id
}
# Bucket for storage of nix cache
resource "cloudflare_r2_bucket" "attic" {
account_id = var.account_id
name = "attic"
location = "weur"
storage_class = "Standard"
}
# Bucket for forgejo storage
resource "cloudflare_r2_bucket" "forgejo" {
account_id = var.account_id
name = "forgejo"
location = "weur"
storage_class = "Standard"
}