Open xtrinch opened 2 years ago
Here's a small example (don't mind the providers argument, that's just bcs in my case most of resources needs to go to eu-central regions) : You use lambda_code_source_dir to point at the folder that contains your lambda code, In my case I overwrite file_globs to also upload redirects.json file if you want to quickly create an cloudwatch kms key there is a module for that as well : https://registry.terraform.io/modules/dod-iac/cloudwatch-kms-key/aws/latest
module "lambda-at-edge" {
providers = {
aws = aws.NVirginia
}
source = "transcend-io/lambda-at-edge/aws"
version = "0.5.0"
cloudwatch_log_groups_kms_arn = module.cloudwatch-kms-key.aws_kms_key_arn
name = "origin-request-lambda-edge"
description = "Used by cloudfront distribution"
runtime = "nodejs16.x"
lambda_code_source_dir = "./lambda/origin-request"
file_globs = ["app.js", "redirects.json"]
handler = "app.handler"
s3_artifact_bucket = var.s3_bucket_lambda_code_name
local_file_dir = "./artifacts"
}
It would be very helpful to have an
examples/
folder with a sample lambda usage example