AWS Lambda トリガーを作成して、DynamoDB テーブルからのストリーミングを処理するやつをTerraformで再現しようとすると こういう感じの書き方になるけれど
resource "aws_lambda_event_source_mapping" "example" { event_source_arn = aws_dynamodb_table.example.stream_arn function_name = aws_lambda_function.example.arn starting_position = "LATEST" }
plan結果はこんな感じで、event_source_arnはLatestStreamArnになるので、あらかじめ決めうちで指定しておくのはおそらく無理で、dataとかresourceのattributeで参照していくしかなさそう
+ resource "aws_lambda_event_source_mapping" "example" { + batch_size = 100 + enabled = true + event_source_arn = "arn:aws:dynamodb:xx-xxxxxxxxx-x:xxxxxxxxxxxx:table/test-table/stream/2021-04-20T10:00:00.555" + function_arn = (known after apply) + function_name = (known after apply) + id = (known after apply) + last_modified = (known after apply) + last_processing_result = (known after apply) + maximum_record_age_in_seconds = (known after apply) + maximum_retry_attempts = (known after apply) + parallelization_factor = (known after apply) + starting_position = "TRIM_HORIZON" + state = (known after apply) + state_transition_reason = (known after apply) + uuid = (known after apply) }