0

I am trying to create a trigger such that every time a new entry in my dynamo table filenames is created, the lambda function trigger_lambda_functionis triggered. I followed this: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping

resource "aws_dynamodb_table" "filenames" {
  name           = local.dynamodb_table_filenames
  billing_mode   = "PROVISIONED"
  read_capacity  = 1000
  write_capacity = 1000
  hash_key       = "filename"

  #range_key      = ""

  attribute {
    name = "filename"
    type = "S"
  }

  tags = var.tags
}


resource "aws_lambda_event_source_mapping" "allow_dynamodb_table_to_trigger_lambda" {
  event_source_arn  = aws_dynamodb_table.filenames.stream_arn
  function_name     = aws_lambda_function.trigger_stepfunction_lambda.arn
  starting_position = "LATEST"
}

Currently, I am getting an error that:

│ Error: error creating Lambda Event Source Mapping (): InvalidParameterValueException: Unrecognized event source.
│ {
│   RespMetadata: {
│     StatusCode: 400,
│     RequestID: "5ae68da6-3f6d-4adb-b104-72ae584dbca7"
│   },
│   Message_: "Unrecognized event source.",
│   Type: "User"
│ }
│ 
│   with module.ingest_system["alpegatm"].aws_lambda_event_source_mapping.allow_dynamodb_table_to_trigger_lambda,
│   on ../../modules/ingest_system/dynamo.tf line 39, in resource "aws_lambda_event_source_mapping" "allow_dynamodb_table_to_trigger_lambda":
│   39: resource "aws_lambda_event_source_mapping" "allow_dynamodb_table_to_trigger_lambda" {

How can I fix this? What is wrong with the event_source_arn I am using?

1 Answer 1

4

I believe you need to turn on streaming for the dynamo table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.