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" {