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

[SQS and Lambda] Lambda function not properly deployed because queue visibility timeout is less than Function timeout #18099

Closed
rafik87 opened this issue Mar 15, 2021 · 3 comments · Fixed by #19425
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. service/sqs Issues and PRs that pertain to the sqs service.
Milestone

Comments

@rafik87
Copy link

rafik87 commented Mar 15, 2021

AWS lambda is not properly deployed because queue visibility timeout is less than Lambda Function timeout

Terraform CLI and Terraform AWS Provider Version

0.13.6

Affected Resource(s)

aws_lambda

Terraform Configuration Files

sqs queue resource configuration:

resource "aws_sqs_queue" "queue" {
name = "sqs-qeue"
message_retention_seconds = 1209600
visibility_timeout_seconds = 400
}

lambda function configuration:

resource "aws_lambda_function" "document_processing_lambda" {
filename = "lambda_function_payload.zip"
function_name = "lambda_function_name"
role = aws_iam_role.iam_for_lambda.arn
handler = "exports.test"
source_code_hash = filebase64sha256("lambda_function_payload.zip")

runtime = "java11"

memory_size = "2048"
timeout = "900"

environment {
variables = {
env= "staging"
}
}
}

aws_lambda_event_source_mapping

resource "aws_lambda_event_source_mapping" "lambda_sqs" {
depends_on = [aws_sqs_queue.queue]
event_source_arn = aws_sqs_queue.queue.arn
function_name = aws_lambda_function.document_processing_lambda.name
batch_size = 10
}

Panic Output

Expected Behavior

This error should be thrown when deploying:
Error: Error creating Lambda event source mapping: InvalidParameterValueException: Queue visibility timeout: 400 seconds is less than Function timeout: 900 seconds

Actual Behavior

No error is thrown at the first deployment and the lambda function is deployed with an incoherent state and does not consume messages from the SQS queue, all this happens silently and messages were lost from the queue because no error is thrown.

Steps to Reproduce

  1. terraform apply
@ghost ghost added service/lambda Issues and PRs that pertain to the lambda service. service/sqs Issues and PRs that pertain to the sqs service. labels Mar 15, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 15, 2021
@bill-rich bill-rich added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 16, 2021
@ewbankkit
Copy link
Contributor

@ghost
Copy link

ghost commented Jun 1, 2021

This has been released in version 3.43.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!

@github-actions
Copy link

github-actions bot commented Jul 2, 2021

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. service/sqs Issues and PRs that pertain to the sqs service.
Projects
None yet
3 participants