Skip to content

Commit 5854123

Browse files
authored
Merge pull request #22 from SPHTech-Platform/feature/application-logging
Advanced Application Logging Settings
2 parents cc66ffb + 59721fa commit 5854123

File tree

4 files changed

+56
-6
lines changed

4 files changed

+56
-6
lines changed

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Requirements
3+
14
| Name | Version |
25
|------|---------|
36
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
47
| <a name="requirement_archive"></a> [archive](#requirement\_archive) | ~> 2.3.0 |
5-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.27 |
8+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.32 |
69

710
## Providers
811

912
| Name | Version |
1013
|------|---------|
11-
| <a name="provider_archive"></a> [archive](#provider\_archive) | ~> 2.3.0 |
12-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.27 |
14+
| <a name="provider_archive"></a> [archive](#provider\_archive) | 2.3.0 |
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.36.0 |
1316

1417
## Modules
1518

1619
| Name | Source | Version |
1720
|------|--------|---------|
18-
| <a name="module_lambda"></a> [lambda](#module\_lambda) | terraform-aws-modules/lambda/aws | ~> 6.0.1 |
21+
| <a name="module_lambda"></a> [lambda](#module\_lambda) | terraform-aws-modules/lambda/aws | ~> 7.2.1 |
1922
| <a name="module_lambda_gha"></a> [lambda\_gha](#module\_lambda\_gha) | philips-labs/github-oidc/aws | ~> 0.7.0 |
2023
| <a name="module_oidc_provider"></a> [oidc\_provider](#module\_oidc\_provider) | philips-labs/github-oidc/aws//modules/provider | ~> 0.7.0 |
2124

@@ -77,6 +80,10 @@
7780
| <a name="input_lambda_at_edge"></a> [lambda\_at\_edge](#input\_lambda\_at\_edge) | Set this to true if using Lambda@Edge, to enable publishing, limit the timeout, and allow edgelambda.amazonaws.com to invoke the function | `bool` | `false` | no |
7881
| <a name="input_lambda_role"></a> [lambda\_role](#input\_lambda\_role) | IAM role ARN attached to the Lambda Function. This governs both who / what can invoke your Lambda Function, as well as what resources our Lambda Function has access to. See Lambda Permission Model for more details. | `string` | `""` | no |
7982
| <a name="input_layers"></a> [layers](#input\_layers) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function. | `list(string)` | `null` | no |
83+
| <a name="input_logging_application_log_level"></a> [logging\_application\_log\_level](#input\_logging\_application\_log\_level) | The application log level of your lambda | `string` | `null` | no |
84+
| <a name="input_logging_log_format"></a> [logging\_log\_format](#input\_logging\_log\_format) | Logging format of your lambda | `string` | `"Text"` | no |
85+
| <a name="input_logging_log_group"></a> [logging\_log\_group](#input\_logging\_log\_group) | Log group that your lambda will use | `string` | `null` | no |
86+
| <a name="input_logging_system_log_level"></a> [logging\_system\_log\_level](#input\_logging\_system\_log\_level) | System log level of your lambda | `string` | `null` | no |
8087
| <a name="input_managed_policy_arns"></a> [managed\_policy\_arns](#input\_managed\_policy\_arns) | List of AWS managed policies to attach to IAM role for Lambda Function | `list(string)` | `null` | no |
8188
| <a name="input_memory_size"></a> [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 |
8289
| <a name="input_number_of_managed_policies"></a> [number\_of\_managed\_policies](#input\_number\_of\_managed\_policies) | Number of AWS managed policies to attach to IAM role for Lambda Function | `number` | `0` | no |
@@ -86,6 +93,7 @@
8693
| <a name="input_policy_jsons"></a> [policy\_jsons](#input\_policy\_jsons) | List of additional policies for the lambda execution | `list(string)` | `[]` | no |
8794
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | Additional Inline Lambda Policy Statements | `any` | `{}` | no |
8895
| <a name="input_publish"></a> [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no |
96+
| <a name="input_recreate_missing_package"></a> [recreate\_missing\_package](#input\_recreate\_missing\_package) | Controls whether to recreate the package if it is missing | `bool` | `true` | no |
8997
| <a name="input_reserved_concurrent_executions"></a> [reserved\_concurrent\_executions](#input\_reserved\_concurrent\_executions) | The amount of reserved concurrent executions for this Lambda Function. A value of 0 disables Lambda Function from being triggered and -1 removes any concurrency limitations. Defaults to Unreserved Concurrency Limits -1. | `number` | `-1` | no |
9098
| <a name="input_role_name"></a> [role\_name](#input\_role\_name) | Name of IAM role to use for Lambda Function. | `string` | `null` | no |
9199
| <a name="input_runtime"></a> [runtime](#input\_runtime) | Lambda Function runtime | `string` | `"nodejs18.x"` | no |
@@ -115,3 +123,4 @@
115123
| <a name="output_lambda_role_name"></a> [lambda\_role\_name](#output\_lambda\_role\_name) | The name of the IAM role created for the Lambda Function |
116124
| <a name="output_lambda_role_unique_id"></a> [lambda\_role\_unique\_id](#output\_lambda\_role\_unique\_id) | The unique id of the IAM role created for the Lambda Function |
117125
| <a name="output_qualified_arn"></a> [qualified\_arn](#output\_qualified\_arn) | The qualified arn of the lambda function to be associated with Cloudfront as a Lambda@Edge function |
126+
<!-- END_TF_DOCS -->

main.tf

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data "archive_file" "dummy" {
99

1010
module "lambda" {
1111
source = "terraform-aws-modules/lambda/aws"
12-
version = "~> 6.0.1"
12+
version = "~> 7.2.1"
1313

1414
function_name = var.function_name
1515
description = var.description
@@ -74,4 +74,9 @@ module "lambda" {
7474

7575
use_existing_cloudwatch_log_group = !var.create_lambda_cloudwatch_log_group
7676
cloudwatch_logs_retention_in_days = var.cloudwatch_logs_retention_in_days
77+
78+
logging_application_log_level = var.logging_application_log_level
79+
logging_log_format = var.logging_log_format
80+
logging_log_group = var.logging_log_group
81+
logging_system_log_level = var.logging_system_log_level
7782
}

variables.tf

+36
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,42 @@ variable "source_path" {
237237
default = null
238238
}
239239

240+
variable "logging_application_log_level" {
241+
type = string
242+
description = "The application log level of your lambda"
243+
default = null
244+
validation {
245+
condition = var.logging_application_log_level == null ? true : contains(["TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"], var.logging_application_log_level)
246+
error_message = "Valid values for logging_info.application_log_level are (TRACE, DEBUG, INFO, WARN, ERROR, FATAL)."
247+
}
248+
}
249+
250+
variable "logging_log_format" {
251+
type = string
252+
description = "Logging format of your lambda"
253+
default = "Text"
254+
validation {
255+
condition = contains(["JSON", "Text"], var.logging_log_format)
256+
error_message = "Valid values for logging_info.log_format are (JSON, Text)."
257+
}
258+
}
259+
260+
variable "logging_log_group" {
261+
type = string
262+
description = "Log group that your lambda will use"
263+
default = null
264+
}
265+
266+
variable "logging_system_log_level" {
267+
type = string
268+
description = "System log level of your lambda"
269+
default = null
270+
validation {
271+
condition = var.logging_system_log_level == null ? true : contains(["DEBUG", "INFO", "WARN", null], var.logging_system_log_level)
272+
error_message = "Valid values for logging_info.system_log_level are (DEBUG, INFO, WARN)."
273+
}
274+
}
275+
240276
############################################
241277
# Lambda Permissions (for allowed triggers)
242278
############################################

versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ terraform {
55
# tflint-ignore: terraform_unused_required_providers
66
aws = {
77
source = "hashicorp/aws"
8-
version = ">= 4.27"
8+
version = ">= 5.32"
99
}
1010
archive = {
1111
source = "hashicorp/archive"

0 commit comments

Comments
 (0)