terraform-aws-modules / terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws
Apache License 2.0
885 stars 658 forks source link

triggers not creating #543

Closed justinTM closed 4 months ago

justinTM commented 4 months ago
  1. add an s3 trigger
    module "lambda" {
        ...
        allowed_triggers = {
            // keys are user-defined and not specific options
            // service is prepended to ".amazonaws.com" internally
            AllowExecutionFromS3 = {
              service  = "s3"
              source_arn = data.aws_s3_bucket.this.arn
            }
        }
    }
  2. no trigger when viewing lambda in AWS Console after terraform Apply
rkostyantyn commented 4 months ago

Correct me if I'm wrong, but the "allowed_triggers" parameter is for triggers that have already been created separately, and only creates policies. To create an s3-event trigger, you need the "aws_s3_bucket_notification" resource, which is not part of this module (I'm looking for that too)

antonbabenko commented 4 months ago

Here is the module for notifications - https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/tree/master/modules/notification , and here is the example - https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/tree/master/examples/notification

@rkostyantyn is correct. The Lambda module only creates policies to allow external triggers.

github-actions[bot] commented 3 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.