Skip to content
Merged
Show file tree
Hide file tree
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
46 changes: 0 additions & 46 deletions spartan/environments/testnet-canary.env

This file was deleted.

46 changes: 32 additions & 14 deletions spartan/terraform/cloudflare/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,42 @@ resource "cloudflare_r2_custom_domain" "aztec_labs_snapshots_com" {
enabled = true
}

locals {
top_level_folders = toset([
"devnet",
"ignition-sepolia",
"next-net",
"staging-ignition",
"staging-public",
])
}

# Lifecycle rules to automatically delete old objects
resource "cloudflare_r2_bucket_lifecycle" "cleanup" {
account_id = var.R2_ACCOUNT_ID
bucket_name = cloudflare_r2_bucket.bucket.name

rules = [
{
id = "delete-snapshot-files"
enabled = true
conditions = { suffix = ".db" }
delete_objects_transition = { days = var.SNAPSHOT_RETENTION_DAYS }
},
{
id = "delete-blob-files"
enabled = true
conditions = { suffix = ".data" }
delete_objects_transition = { days = var.BLOB_RETENTION_DAYS }
},
]
rules = flatten([
for folder in local.top_level_folders : [
{
id = "delete-snapshots-${folder}"
enabled = true
conditions = { prefix = "${folder}/aztec" }
delete_objects_transition = { days = var.SNAPSHOT_RETENTION_DAYS }
},
{
id = "delete-blobs-${folder}"
enabled = true
conditions = { prefix = "${folder}/blobs" }
delete_objects_transition = { days = var.BLOB_RETENTION_DAYS }
},
{
id = "delete-txs-${folder}"
enabled = true
conditions = { prefix = "${folder}/txs" }
delete_objects_transition = { days = var.TX_RETENTION_DAYS }
},
]
])
}

6 changes: 6 additions & 0 deletions spartan/terraform/cloudflare/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ variable "SNAPSHOT_RETENTION_DAYS" {
default = 7
description = "Number of days to retain snapshots"
}

variable "TX_RETENTION_DAYS" {
type = number
default = 1
description = "Number of days to retain txs"
}
Loading