Skip to content

Commit b4b29bf

Browse files
fix: Allow Pipes with Kinesis Targets (#143)
Co-authored-by: Anton Babenko <[email protected]>
1 parent c947f01 commit b4b29bf

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

examples/with-pipes/main.tf

+39
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,39 @@ module "eventbridge" {
187187
}
188188
}
189189

190+
# With Kinesis Stream source and Kinesis Stream target
191+
kinesis_source_kinesis_target = {
192+
source = aws_kinesis_stream.source.arn
193+
target = aws_kinesis_stream.target.arn
194+
195+
source_parameters = {
196+
kinesis_stream_parameters = {
197+
batch_size = 7
198+
maximum_batching_window_in_seconds = 90
199+
maximum_record_age_in_seconds = 100
200+
maximum_retry_attempts = 4
201+
on_partial_batch_item_failure = "AUTOMATIC_BISECT"
202+
parallelization_factor = 5
203+
starting_position = "TRIM_HORIZON"
204+
starting_position_timestamp = null
205+
dead_letter_config = {
206+
arn = aws_sqs_queue.dlq.arn
207+
}
208+
}
209+
}
210+
211+
target_parameters = {
212+
kinesis_stream_parameters = {
213+
# Must be a json path and start with $.
214+
partition_key = "$.id"
215+
}
216+
}
217+
218+
tags = {
219+
Pipe = "kinesis_source_kinesis_target"
220+
}
221+
}
222+
190223
# With SQS Queue source and EventBridge target
191224
sqs_source_eventbridge_target = {
192225
source = aws_sqs_queue.source.arn
@@ -429,6 +462,12 @@ resource "aws_kinesis_stream" "source" {
429462
shard_count = 1
430463
}
431464

465+
resource "aws_kinesis_stream" "target" {
466+
name = "${random_pet.this.id}-target"
467+
468+
shard_count = 1
469+
}
470+
432471
##################################
433472
# CloudWatch Log Group and Stream
434473
##################################

iam_pipes.tf

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ locals {
2929

3030
# Enrichment / Target
3131
lambda = {
32-
values = [v.target, try(aws_cloudwatch_event_api_destination.this[v.enrichment].arn, null)],
32+
values = [v.target, try(v.enrichment, null), try(aws_cloudwatch_event_api_destination.this[v.enrichment].arn, null)],
3333
matching_services = ["lambda"]
3434
},
3535
step_functions = {
@@ -191,7 +191,8 @@ locals {
191191

192192
kinesis_target = {
193193
actions = [
194-
"kinesis:PutRecord"
194+
"kinesis:PutRecord",
195+
"kinesis:PutRecords"
195196
]
196197
}
197198

main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,13 @@ resource "aws_pipes_pipe" "this" {
738738
message_group_id = try(sqs_queue_parameters.value.message_group_id, null)
739739
}
740740
}
741+
dynamic "kinesis_stream_parameters" {
742+
for_each = try([target_parameters.value.kinesis_stream_parameters], [])
743+
744+
content {
745+
partition_key = try(kinesis_stream_parameters.value.partition_key, null)
746+
}
747+
}
741748

742749
dynamic "cloudwatch_logs_parameters" {
743750
for_each = try([target_parameters.value.cloudwatch_logs_parameters], [])

0 commit comments

Comments
 (0)