File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,26 @@ resource "google_storage_bucket" "this" {
51
51
# Since the bucket is just a temporary storage for asset export objects until
52
52
# the function can process them, we want to implicitly delete any leftover objects
53
53
# if Terraform plans to remove the bucket
54
+
55
+ # added for maintaining the bucket file and folder lifecycle
56
+ lifecycle_rule {
57
+ condition {
58
+ age = var. bucket_lifecycle_delete_days
59
+ }
60
+ action {
61
+ type = " Delete"
62
+ }
63
+ }
64
+
65
+ lifecycle_rule {
66
+ condition {
67
+ age = var. bucket_lifecycle_abort_upload_days
68
+ }
69
+ action {
70
+ type = " AbortIncompleteMultipartUpload"
71
+ }
72
+ }
73
+
54
74
}
55
75
56
76
resource "google_storage_bucket_iam_member" "bucket_iam" {
Original file line number Diff line number Diff line change @@ -239,4 +239,16 @@ variable "cloud_function_debug_level" {
239
239
description = " The debug level for the GCP cloud functions"
240
240
type = string
241
241
default = " WARNING"
242
+ }
243
+
244
+ variable "bucket_lifecycle_delete_days" {
245
+ description = " The number of days to wait before Delete of temporary bucket files."
246
+ type = number
247
+ default = 14
248
+ }
249
+
250
+ variable "bucket_lifecycle_abort_upload_days" {
251
+ description = " The number of days to wait before deleting AbortIncompleteMultipartUpload."
252
+ type = number
253
+ default = 7
242
254
}
You can’t perform that action at this time.
0 commit comments