Event sources and SNS subscriptions
New Features
Possibilities to configure SNS subscriptions and event source mappings for Dynamodb, Kinesis and SQS have been enhanced with this release.
Event source mappings
A new variable event_source_mappings
has been introduced. The new configuration supports:
- configuration of N event sources instead of only one
- using Lambda aliases in event source mappings
- event sources like SQS queues or Dynamodb tables can be part of the same terraform stack as resources
- inline configuration of attributes of event source mappings like
batch_size
- required IAM permissions depending on the event source type will be generated
simple example
module "lambda" {
event_source_mappings = {
queue_1 = {
event_source_arn = aws_sqs_queue.queue_1.arn
}
queue_2 = {
event_source_arn = aws_sqs_queue.queue_2.arn
}
}
}
see examples for further details.
SNS subscriptions
A new variable sns_subscriptions
has been introduced. The new configuration supports:
- configuration of N subscriptions instead of only one
- using Lambda aliases in subscriptions
- SNS topics can be part of the same terraform stack as resources
- required permissions to trigger Lambda by SNS will be generated
simple example
module "lambda" {
sns_subscriptions = {
topic_1 = {
topic_arn = aws_sns_topic.topic_1.arn
}
topic_2 = {
topic_arn = aws_sns_topic.topic_2.arn
}
}
}
see example for further details.
Deprecations
Using the event
variable to configure sns
, dynamodb
, kinesis
and sqs
terraform sub-modules is deprecated and will be removed in the next major release. Users should be able to migrate to the new variables without downtime.
Special thanks
Thanks @machadovilaca for providing the new sns subscriptions implementation!
Misc
- new/updated examples have been enhanced to contain working
nodejs12.x
handlers for real world testing - first terratest for new event source implementation
What's Changed
- use tf version matrix on ci by @moritzzimmer in #16
- Allow multiple SNS topic subscriptions by @machadovilaca in #17
- Refactoring of event source mappings by @moritzzimmer in #19
- added support for using aliases in sns subscriptions by @moritzzimmer in #21
New Contributors
- @machadovilaca made their first contribution in #17
Full Changelog: v5.7.0...v5.8.0