@cryptotaxi247 / infra / commits / 9cf1919d

enable bucket versioning

OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create ~ update in-place OpenTofu will perform the following actions: # aws_s3_bucket_lifecycle_configuration.cache will be updated in-place ~ resource "aws_s3_bucket_lifecycle_configuration" "cache" { id = "nix-cache" # (3 unchanged attributes hidden) + rule { + id = "Non-current Versions" + status = "Enabled" + noncurrent_version_expiration { + noncurrent_days = 30 } } # (1 unchanged block hidden) } # aws_s3_bucket_versioning.cache will be created + resource "aws_s3_bucket_versioning" "cache" { + bucket = "nix-cache" + id = (known after apply) + region = "us-east-1" + versioning_configuration { + mfa_delete = (known after apply) + status = "Enabled" } } Plan: 1 to add, 1 to change, 0 to destroy. ╷

Arian van Putten committed Feb 19, 2026 at 18:26 UTC 9cf1919dd07f19c84863215857b5e8032826c873
1 file changed +20
terraform/cache.tf
+20
@@ -7,10 +7,20 @@ resource "aws_s3_bucket" "cache" {
7 bucket = "nix-cache"
8 }
9
10 +resource "aws_s3_bucket_versioning" "cache" {
11 + provider = aws.us
12 + bucket = aws_s3_bucket.cache.id
13 + versioning_configuration {
14 + status = "Enabled"
15 + }
16 +}
17 +
18 resource "aws_s3_bucket_lifecycle_configuration" "cache" {
19 provider = aws.us
20 bucket = aws_s3_bucket.cache.id
21
22 + depends_on = [aws_s3_bucket_versioning.cache]
23 +
24 transition_default_minimum_object_size = "varies_by_storage_class"
25
26 rule {
@@ -26,6 +36,16 @@ resource "aws_s3_bucket_lifecycle_configuration" "cache" {
36 storage_class = "STANDARD_IA"
37 }
38 }
39 +
40 + # We delete no-current versions after 30 days
41 + rule {
42 + id = "Non-current Versions"
43 + status = "Enabled"
44 +
45 + noncurrent_version_expiration {
46 + noncurrent_days = 30
47 + }
48 + }
49 }
50
51 import {