Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide usage example? #23

Open
xtrinch opened this issue Aug 4, 2022 · 1 comment
Open

Provide usage example? #23

xtrinch opened this issue Aug 4, 2022 · 1 comment

Comments

@xtrinch
Copy link

xtrinch commented Aug 4, 2022

It would be very helpful to have an examples/ folder with a sample lambda usage example

@TheVexy
Copy link

TheVexy commented Oct 10, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants