Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions event_source_mappings.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ resource "aws_lambda_event_source_mapping" "event_source" {
}
}

dynamic "metrics_config" {
for_each = try([each.value.metrics_config], [])

content {
metrics = metrics_config.value.metrics
}
}

dynamic "scaling_config" {
for_each = try(each.value.scaling_config, null) != null ? [true] : []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ module "lambda" {
// see https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html
destination_arn_on_failure = aws_sqs_queue.errors.arn


// Lambda event filtering, see https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html
filter_criteria = [
{
Expand All @@ -99,6 +98,11 @@ module "lambda" {
})
}
]

// Event source mapping metrics, see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics
metrics_config = {
metrics = ["EventCount"]
}
}

table_2 = {
Expand Down
5 changes: 5 additions & 0 deletions examples/with-event-source-mappings/kinesis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ module "lambda" {
})
}
]

// Event source mapping metrics, see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics
metrics_config = {
metrics = ["EventCount"]
}
}

stream_2 = {
Expand Down
13 changes: 9 additions & 4 deletions examples/with-event-source-mappings/sqs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ module "lambda" {
// optionally overwrite arguments from https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping
batch_size = 5

scaling_config = {
maximum_concurrency = 2
}

// Lambda event filtering, see https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html
filter_criteria = [
{
Expand All @@ -66,6 +62,15 @@ module "lambda" {
})
}
]

// Event source mapping metrics, see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html#event-source-mapping-metrics
metrics_config = {
metrics = ["EventCount"]
}

scaling_config = {
maximum_concurrency = 2
}
}

queue_2 = {
Expand Down