Skip to content

Commit

Permalink
Make logging variables top level for simple_bucket module
Browse files Browse the repository at this point in the history
  • Loading branch information
matty-rose committed Jun 2, 2021
1 parent 44dc037 commit a4e7c96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions modules/simple_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ resource "google_storage_bucket" "bucket" {
}

dynamic "logging" {
for_each = var.logging == null ? [] : [var.logging]
for_each = var.log_bucket == null ? [] : [var.log_bucket]
content {
log_bucket = var.logging.log_bucket
log_object_prefix = var.logging.log_object_prefix == "" ? var.name : var.logging.log_object_prefix
log_bucket = var.log_bucket
log_object_prefix = var.log_object_prefix
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions modules/simple_bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,14 @@ variable "lifecycle_rules" {
default = []
}

variable "logging" {
description = "Configuration of the bucket's access and storage logs. If log_object_prefix is set to the empty string, the name of the bucket will be used."
type = object({
log_bucket = string
log_object_prefix = string
})
default = null
variable "log_bucket" {
description = "The bucket that will receive log objects."
type = string
default = null
}

variable "log_object_prefix" {
description = "The object prefix for log objects. If it's not provided, by default GCS sets this to this bucket's name"
type = string
default = null
}

0 comments on commit a4e7c96

Please sign in to comment.