Skip to content

Commit 51578aa

Browse files
authored
fix: Fix kinesis_target and kinesis_parameters dynamic blocks (#124)
1 parent 7b2e22f commit 51578aa

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

examples/complete/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ module "eventbridge" {
105105
attach_role_arn = true
106106
},
107107
{
108-
name = "send-orders-to-kinesis"
109-
arn = aws_kinesis_stream.this.arn
110-
dead_letter_arn = aws_sqs_queue.dlq.arn
111-
input_transformer = local.order_input_transformer
112-
attach_role_arn = true
108+
name = "send-orders-to-kinesis"
109+
arn = aws_kinesis_stream.this.arn
110+
dead_letter_arn = aws_sqs_queue.dlq.arn
111+
input_transformer = local.order_input_transformer
112+
partition_key_path = "$.id"
113+
attach_role_arn = true
113114
},
114115
{
115116
name = "process-email-with-ecs-task",

examples/with-schedules/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Note that this example may create resources which cost money. Run `terraform des
2828

2929
| Name | Version |
3030
|------|---------|
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.27 |
3132
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3233
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3334

@@ -42,6 +43,7 @@ Note that this example may create resources which cost money. Run `terraform des
4243

4344
| Name | Type |
4445
|------|------|
46+
| [aws_kinesis_stream.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_stream) | resource |
4547
| [null_resource.download_package](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
4648
| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
4749

examples/with-schedules/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ module "eventbridge" {
4242
schedule_expression = "rate(10 hours)"
4343
arn = module.lambda.lambda_function_arn
4444
}
45+
kinesis-cron = {
46+
group_name = "prod"
47+
schedule_expression = "rate(10 hours)"
48+
arn = aws_kinesis_stream.this.arn
49+
partition_key = "foo"
50+
}
4551
}
4652
}
4753

@@ -53,6 +59,11 @@ resource "random_pet" "this" {
5359
length = 2
5460
}
5561

62+
resource "aws_kinesis_stream" "this" {
63+
name = random_pet.this.id
64+
shard_count = 1
65+
}
66+
5667
#############################################
5768
# Using packaged function from Lambda module
5869
#############################################

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ resource "aws_cloudwatch_event_target" "this" {
195195
}
196196

197197
dynamic "kinesis_target" {
198-
for_each = lookup(each.value, "kinesis_target", null) != null ? [true] : []
198+
for_each = lookup(each.value, "partition_key_path", null) != null ? [true] : []
199199

200200
content {
201-
partition_key_path = lookup(kinesis_target.value, "partition_key_path", null)
201+
partition_key_path = each.value.partition_key_path
202202
}
203203
}
204204

@@ -561,10 +561,10 @@ resource "aws_scheduler_schedule" "this" {
561561
}
562562

563563
dynamic "kinesis_parameters" {
564-
for_each = lookup(each.value, "kinesis_parameters", null) != null ? [true] : []
564+
for_each = lookup(each.value, "partition_key", null) != null ? [true] : []
565565

566566
content {
567-
partition_key = kinesis_parameters.value.partition_key
567+
partition_key = each.value.partition_key
568568
}
569569
}
570570

0 commit comments

Comments
 (0)