Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for maximum batching window parameter for lambda event source mapping #10080

Closed
nerixim opened this issue Sep 12, 2019 · 5 comments
Closed
Assignees
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@nerixim
Copy link

nerixim commented Sep 12, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

In some cases, it's necessary to specify the batching window parameter, e.g. to accumulate batches of events. AWS CLI supports that (--maximum-batching-window-in-seconds parameter) so Terraform should support that too.
I haven't yet fiddled with Terraform code before but I'd like to implement it.

Thank you guys for your continued work.

New or Affected Resource(s)

  • aws_lambda_event_source_mapping

Potential Terraform Configuration

For Kinesis, but would be similar for SQS or DynamoDB streams.

resource "aws_lambda_event_source_mapping" "kinesis_to_lambda" {
  event_source_arn        = aws_kinesis_stream.kinesis_stream.arn
  function_name           = aws_lambda_function.kinesis_handler.arn
  batch_size              = 100
  maximum_batching_window = 5
}

References

@nerixim nerixim added the enhancement Requests to existing resources that expand the functionality or scope. label Sep 12, 2019
@ghost ghost added the service/lambda Issues and PRs that pertain to the lambda service. label Sep 12, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 12, 2019
@petewilcock
Copy link

For anyone wondering about a workaround in the meantime:

  1. Create event source mapping in TF as usual. Make a note of the uuid from the created resource.
  2. Modify the mapping using the aws-cli (latest version required):

aws lambda update-event-source-mapping --uuid 1cd76e1c-221f-4f9d-a64b-31bb5e0bee6f --maximum-batching-window-in-seconds 10

As Terraform isn't aware of the attribute, it won't prompt any changes on the next plan, but will prompt a change once the provider supports the attribute.

Note it has to be done this way around, as event source mappings are immutable when looking at them in the console (no edits allowed), and if you try to manually create and import into TF, it will try to destroy/recreate regardless as (as noted in TF docs) "AWS does not expose startingPosition information for existing Lambda event source mappings".

@eliran-lightricks
Copy link

Came across this Pull Request

@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Nov 19, 2019
@bflad bflad self-assigned this Nov 19, 2019
@bflad bflad added this to the v2.39.0 milestone Nov 20, 2019
@bflad
Copy link
Contributor

bflad commented Nov 20, 2019

Support for the new maximum_batching_window_in_seconds argument in the aws_lambda_event_source_mapping resource has been merged and will release with version 2.39.0 of the Terraform AWS Provider, likely tomorrow. Thanks to @tiny-dancer for the implementation. 👍

@bflad bflad closed this as completed Nov 20, 2019
@ghost
Copy link

ghost commented Nov 21, 2019

This has been released in version 2.39.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

4 participants