Skip to content

Commit 9572b75

Browse files
committed
Add access log retention policy
1 parent bf66f63 commit 9572b75

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

modules/cloud-storage-static-website/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ resource "google_storage_bucket" "access_logs" {
105105
}
106106
}
107107

108+
dynamic "retention_policy" {
109+
for_each = var.access_logs_retention_policy == null ? [] : [var.access_logs_retention_policy]
110+
content {
111+
is_locked = var.access_logs_retention_policy.is_locked
112+
retention_period = var.access_logs_retention_policy.retention_period
113+
}
114+
}
115+
108116
lifecycle_rule {
109117
action {
110118
type = "Delete"

modules/cloud-storage-static-website/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,11 @@ variable "custom_labels" {
143143
default = {}
144144
}
145145

146+
variable "access_logs_retention_policy" {
147+
description = "Configuration of the access logs bucket's data retention policy for how long access log objects in the bucket should be retained."
148+
type = object({
149+
is_locked = bool
150+
retention_period = number
151+
})
152+
default = null
153+
}

0 commit comments

Comments
 (0)