// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 resource "aws_lambda_function" "function" { function_name = var.FUNCTION_NAME s3_bucket = var.S3_BUCKET s3_key = var.S3_KEY runtime = "python3.8" handler = var.LAMBDA_HANDLER timeout = 300 publish = true source_code_hash = var.SOURCE_CODE_HASH // role = aws_iam_role.lambda_exec.arn role = var.LAMBDA_IAM_ROLE vpc_config { subnet_ids = var.SUBNET_IDS security_group_ids = var.SECURITY_GROUP_IDS } tracing_config { mode = "Active" } // reserved_concurrent_executions = 3 #checkov:skip=CKV_AWS_115: "Ensure that AWS Lambda function is configured for function-level concurrent execution limit" #checkov:skip=CKV_AWS_116:Ensure that AWS Lambda function is configured for a Dead Letter Queue(DLQ) } resource "aws_lambda_provisioned_concurrency_config" "function_concurrency" { function_name = aws_lambda_function.function.function_name provisioned_concurrent_executions = 3 qualifier = aws_lambda_function.function.version } data "aws_caller_identity" "current" {} data "aws_region" "current" {} resource "aws_kms_key" "key" { description = "app-rotation-${var.FUNCTION_NAME}-log-key" enable_key_rotation = true tags = { Name ="app-rotation-${var.FUNCTION_NAME}-log-key" } policy = <