From b9a6ea18aa5b060d9d1b6e1bddfa50f60954da0d Mon Sep 17 00:00:00 2001 From: Andrew Hay <39sumer3939@gmail.com> Date: Wed, 31 Jan 2024 01:40:54 -0600 Subject: [PATCH] fix: Dynamic logging config for Gov Cloud (#541) --- main.tf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index e9a35e75..62a1fcab 100644 --- a/main.tf +++ b/main.tf @@ -112,11 +112,17 @@ resource "aws_lambda_function" "this" { } } - logging_config { - log_group = var.logging_log_group - log_format = var.logging_log_format - application_log_level = var.logging_application_log_level - system_log_level = var.logging_system_log_level + dynamic "logging_config" { + # Dont create logging config on gov cloud as it is not avaible. + # See https://github.com/hashicorp/terraform-provider-aws/issues/34810 + for_each = data.aws_partition.current.partition == "aws" ? [true] : [] + + content { + log_group = var.logging_log_group + log_format = var.logging_log_format + application_log_level = var.logging_application_log_level + system_log_level = var.logging_system_log_level + } } dynamic "timeouts" {