Skip to content

Commit 04f7fc9

Browse files
[CI] Add Lifecycle Rules to GCS Buckets
This patch adds lifecycle rules to the GCS buckets to delete old objects. We do not want to keep object files around for very long as they quickly become out of date. GCS does not keep track of the last time a file was fetched, so we have to rely on the creation date. The granularity for when to delete an object can only be specified in days, so we set it to one day for now. Reviewers: dschuff, lnihlen, cmtice, gburgessiv, Keenuts Reviewed By: cmtice Pull Request: #519
1 parent fdcb7ac commit 04f7fc9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

premerge/gke_cluster/main.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ resource "google_storage_bucket" "object_cache_linux" {
175175
soft_delete_policy {
176176
retention_duration_seconds = 0
177177
}
178+
179+
lifecycle_rule {
180+
action {
181+
type = "Delete"
182+
}
183+
condition {
184+
days_since_noncurrent_time = 1
185+
}
186+
}
178187
}
179188

180189
resource "google_storage_bucket" "object_cache_windows" {
@@ -187,6 +196,15 @@ resource "google_storage_bucket" "object_cache_windows" {
187196
soft_delete_policy {
188197
retention_duration_seconds = 0
189198
}
199+
200+
lifecycle_rule {
201+
action {
202+
type = "Delete"
203+
}
204+
condition {
205+
days_since_noncurrent_time = 1
206+
}
207+
}
190208
}
191209

192210
resource "google_service_account" "object_cache_linux_gsa" {

0 commit comments

Comments
 (0)