diff --git a/README.md b/README.md
index bf847486..5b4504d5 100644
--- a/README.md
+++ b/README.md
@@ -808,6 +808,10 @@ No modules.
| [layers](#input\_layers) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function. | `list(string)` | `null` | no |
| [license\_info](#input\_license\_info) | License info for your Lambda Layer. Eg, MIT or full url of a license. | `string` | `""` | no |
| [local\_existing\_package](#input\_local\_existing\_package) | The absolute path to an existing zip-file to use | `string` | `null` | no |
+| [logging\_config\_application\_log\_level](#input\_logging\_config\_application\_log\_level) | The application log level of the Lambda Function. Valid values are "TRACE", "DEBUG", "INFO", "WARN", "ERROR", or "FATAL". | `string` | `null` | no |
+| [logging\_config\_log\_format](#input\_logging\_config\_log\_format) | The log format of the Lambda Function. Valid values are "JSON" or "Text". | `string` | `null` | no |
+| [logging\_config\_log\_group](#input\_logging\_config\_log\_group) | The CloudWatch log group to send logs to. | `string` | `null` | no |
+| [logging\_config\_system\_log\_level](#input\_logging\_config\_system\_log\_level) | The system log level of the Lambda Function. Valid values are "DEBUG", "INFO", or "WARN". | `string` | `null` | no |
| [maximum\_event\_age\_in\_seconds](#input\_maximum\_event\_age\_in\_seconds) | Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600. | `number` | `null` | no |
| [maximum\_retry\_attempts](#input\_maximum\_retry\_attempts) | Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2. | `number` | `null` | no |
| [memory\_size](#input\_memory\_size) | Amount of memory in MB your Lambda Function can use at runtime. Valid value between 128 MB to 10,240 MB (10 GB), in 64 MB increments. | `number` | `128` | no |
diff --git a/examples/complete/main.tf b/examples/complete/main.tf
index 62e51084..9b27f0f8 100644
--- a/examples/complete/main.tf
+++ b/examples/complete/main.tf
@@ -27,6 +27,8 @@ module "lambda_function" {
architectures = ["x86_64"]
publish = true
+ logging_config_log_format = "JSON"
+
source_path = "${path.module}/../fixtures/python3.8-app1"
store_on_s3 = true
diff --git a/main.tf b/main.tf
index 76ce118d..71e4a486 100644
--- a/main.tf
+++ b/main.tf
@@ -112,6 +112,16 @@ resource "aws_lambda_function" "this" {
}
}
+ dynamic "logging_config" {
+ for_each = var.logging_config_log_format != null ? [true] : []
+ content {
+ log_format = var.logging_config_log_format
+ application_log_level = var.logging_config_application_log_level
+ system_log_level = var.logging_config_system_log_level
+ log_group = var.logging_config_log_group
+ }
+ }
+
timeouts {
create = try(var.timeouts.create, null)
update = try(var.timeouts.update, null)
diff --git a/variables.tf b/variables.tf
index 61198bea..8d71aee3 100644
--- a/variables.tf
+++ b/variables.tf
@@ -761,3 +761,31 @@ variable "recreate_missing_package" {
type = bool
default = true
}
+
+############################################
+# Lambda Advanced Logging Settings
+############################################
+
+variable "logging_config_log_format" {
+ description = "The log format of the Lambda Function. Valid values are \"JSON\" or \"Text\"."
+ type = string
+ default = null
+}
+
+variable "logging_config_application_log_level" {
+ description = "The application log level of the Lambda Function. Valid values are \"TRACE\", \"DEBUG\", \"INFO\", \"WARN\", \"ERROR\", or \"FATAL\"."
+ type = string
+ default = null
+}
+
+variable "logging_config_system_log_level" {
+ description = "The system log level of the Lambda Function. Valid values are \"DEBUG\", \"INFO\", or \"WARN\"."
+ type = string
+ default = null
+}
+
+variable "logging_config_log_group" {
+ description = "The CloudWatch log group to send logs to."
+ type = string
+ default = null
+}
diff --git a/wrappers/main.tf b/wrappers/main.tf
index 1ae65252..1799841d 100644
--- a/wrappers/main.tf
+++ b/wrappers/main.tf
@@ -75,6 +75,10 @@ module "wrapper" {
layers = try(each.value.layers, var.defaults.layers, null)
license_info = try(each.value.license_info, var.defaults.license_info, "")
local_existing_package = try(each.value.local_existing_package, var.defaults.local_existing_package, null)
+ logging_config_application_log_level = try(each.value.logging_config_application_log_level, var.defaults.logging_config_application_log_level, null)
+ logging_config_log_format = try(each.value.logging_config_log_format, var.defaults.logging_config_log_format, null)
+ logging_config_log_group = try(each.value.logging_config_log_group, var.defaults.logging_config_log_group, null)
+ logging_config_system_log_level = try(each.value.logging_config_system_log_level, var.defaults.logging_config_system_log_level, null)
maximum_event_age_in_seconds = try(each.value.maximum_event_age_in_seconds, var.defaults.maximum_event_age_in_seconds, null)
maximum_retry_attempts = try(each.value.maximum_retry_attempts, var.defaults.maximum_retry_attempts, null)
memory_size = try(each.value.memory_size, var.defaults.memory_size, 128)