From a4e7c96ccac3067303c9ed2e21486800a912d73b Mon Sep 17 00:00:00 2001 From: Matthew Rose Date: Thu, 3 Jun 2021 09:49:30 +1000 Subject: [PATCH] Make logging variables top level for simple_bucket module --- modules/simple_bucket/main.tf | 6 +++--- modules/simple_bucket/variables.tf | 17 ++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/simple_bucket/main.tf b/modules/simple_bucket/main.tf index aa33f58f..23580d10 100644 --- a/modules/simple_bucket/main.tf +++ b/modules/simple_bucket/main.tf @@ -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 } } } diff --git a/modules/simple_bucket/variables.tf b/modules/simple_bucket/variables.tf index 7c7aca83..81c76779 100644 --- a/modules/simple_bucket/variables.tf +++ b/modules/simple_bucket/variables.tf @@ -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 }