Home > front end >  error updating DynamoDB Table: Table already has an enabled stream
error updating DynamoDB Table: Table already has an enabled stream

Time:11-18

I am defining a dynamo table and trigger like this:

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

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

Upon running terraform apply, I get the following error:

error updating DynamoDB Table (xzy): ValidationException: Table already has an enabled stream: TableName: 4 xzy

I didn't see this error before I added stream_enabled and stream_view_type. If I remove these two attributes, I will get another error so I cannot remove them.

CodePudding user response:

dynamo db Stream It might have been enabled from the beigining You cant change parameter of stream_view_type already enabled dynamodb stream, dynamodb doucmention didnt mentioned it.

I suggest you Create a new table and enable the dyanmodb stream_enabled: true and stream_view_type:[] both at once.

  • Related