Hello,
I have a resource of aws_kinesis_stream that is created by using a for_each expression from a variable that contains a map.
variable "stream_envs" {
default = {
dev = "dev-stream"
staging = "staging-stream"
prod = "prod-stream"
}
}
resource "aws_kinesis_stream" "cwl_kinesis_stream" {
for_each = var.stream_envs
name = each.value
shard_count = 1
retention_period = 24
shard_level_metrics = [
"IncomingBytes",
"OutgoingBytes",
"IncomingRecords",
"OutgoingRecords",
"WriteProvisionedThroughputExceeded",
"ReadProvisionedThroughputExceeded",
"IteratorAgeMilliseconds"
]
tags = {
Environment = each.key
Team = "Devops"
managed_by = "Terraform"
Role = each.value
}
}
This portion looks to be working as expected. However, I want to create an aws_kinesis_firehose_delivery_stream that uses my Kinesis stream as a source for every environment. For example, dev kinesis stream correlates to dev firehose stream
resource "aws_kinesis_firehose_delivery_stream" "s3_delivery_stream" {
for_each = var.stream_envs
name = format("%s-firehose_s3_destination", each.key)
destination = "extended_s3"
kinesis_source_configuration {
kinesis_stream_arn = <kinesis stream>
role_arn = "arn:aws:iam::my_role"
}
extended_s3_configuration {
role_arn = "arn:aws:iam::my_role"
bucket_arn = "arn:aws:s3:::my_bucket"
buffer_size = "5"
buffer_interval = "300"
compression_format = "UNCOMPRESSED"
processing_configuration {
enabled = "true"
processors {
type = "Lambda"
parameters {
parameter_name = "LambdaArn"
parameter_value = "arn:aws:lambda::my_lambda:$LATEST"
}
}
}
}
tags = {
Environment = each.key
Team = "Devops"
managed_by = "Terraform"
Role = format("%s-firehose_s3_destination", each.key)
}
depends_on = [
aws_kinesis_stream.cwl_kinesis_stream,
]
}
How can I achieve this?
Thanks