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

aws_lambda_event_source_mapping - maximum_retry_attempts are set to 10000 when trying to set 0 #12448

Closed
cybulr opened this issue Mar 18, 2020 · 3 comments · Fixed by #12479
Closed
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@cybulr
Copy link

cybulr commented Mar 18, 2020

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 other comments that do not add relevant new information or questions, 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

Terraform Version

Terraform v0.12.21

  • provider.aws v2.51.0

Affected Resource(s)

  • aws_lambda_event_source_mapping

Terraform Configuration Files

resource "aws_lambda_event_source_mapping" "kinesis" {
  count                  = var.kinesis_trigger != null && var.enabled  ? 1 : 0
  event_source_arn       = var.kinesis_trigger.event_source_arn
  function_name          = aws_lambda_function.lambda.function_name
  starting_position      = var.kinesis_trigger.starting_position
  batch_size             = var.kinesis_trigger.batch_size
  parallelization_factor = var.kinesis_trigger.parallelization_factor
  maximum_retry_attempts = var.kinesis_trigger.maximum_retry_attempts
  destination_config {
    on_failure {
      destination_arn = var.kinesis_trigger.destination_arn_on_failure
    }
  }
}

    kinesis_trigger = {
        event_source_arn  		      = "arn:aws:kinesis:eu-west-1:XXX:stream/XXX"
        starting_position 		      = "LATEST"
        batch_size        		      = 100       
        parallelization_factor	    = 1
        maximum_retry_attempts	    = 0
        destination_arn_on_failure	= "arn:aws:sqs:eu-west-1:XXX:XXX"
    }

Terraform apply Output

  # module.XXX.aws_lambda_event_source_mapping.kinesis[0] will be created
  + resource "aws_lambda_event_source_mapping" "kinesis" {
      + batch_size                    = 100
      + enabled                       = true
      + event_source_arn              = "arn:aws:kinesis:eu-west-1:XXX:stream/XXX"
      + function_arn                  = (known after apply)
      + function_name                 = "XXX"
      + id                            = (known after apply)
      + last_modified                 = (known after apply)
      + last_processing_result        = (known after apply)
      + maximum_record_age_in_seconds = (known after apply)
      + maximum_retry_attempts        = 0
      + parallelization_factor        = 1
      + starting_position             = "LATEST"
      + state                         = (known after apply)
      + state_transition_reason       = (known after apply)
      + uuid                          = (known after apply)

      + destination_config {
          + on_failure {
              + destination_arn = "arn:aws:sqs:eu-west-1:XXX:XXX"
            }
        }
    }

module.preprocessor.aws_lambda_event_source_mapping.kinesis[0]: Creation complete after 1s [id=489db491-ae3e-4660-b19e-2560972670f5]

aws lambda list-event-source-mappings Output

    "EventSourceMappings": [
        {
            "UUID": "489db491-ae3e-4660-b19e-2560972670f5",
            "BatchSize": 100,
            "MaximumBatchingWindowInSeconds": 0,
            "ParallelizationFactor": 1,
            "EventSourceArn": "arn:aws:kinesis:eu-west-1:XXX:stream/XXX",
            "FunctionArn": "arn:aws:lambda:eu-west-1:XXX:function:XXX",
            "LastModified": 1584550140.0,
            "LastProcessingResult": "No records processed",
            "State": "Enabled",
            "StateTransitionReason": "User action",
            "DestinationConfig": {
                "OnFailure": {
                    "Destination": "arn:aws:sqs:eu-west-1:XXX:XXX"
                }
            },
            "MaximumRecordAgeInSeconds": 604800,
            "BisectBatchOnFunctionError": false,
            "MaximumRetryAttempts": 10000
        },

Expected Behavior

As we can see in terraform apply output, event source mapping with 0 retries should be created.

Actual Behavior

When setting up 0 as a value in terraform for Maximum Retry Attempts, it always creates a mapping with default value 10000 instead of 0. For all other values it works correctly. I also checked result of creating it using AWS CLI and it works correctly for value of "0", so I think there is an bug in provider.

Steps to Reproduce

  1. terraform apply
  2. 'aws lambda list-event-source-mappings'
@ghost ghost added the service/lambda Issues and PRs that pertain to the lambda service. label Mar 18, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 18, 2020
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 25, 2020
@anGie44 anGie44 added this to the v3.1.0 milestone Jul 31, 2020
@anGie44
Copy link
Contributor

anGie44 commented Jul 31, 2020

The bug fix has been merged and will release with the upcoming v3.1.0 of the Terraform AWS Provider.

@ghost
Copy link

ghost commented Aug 7, 2020

This has been released in version 3.1.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 Aug 31, 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 Aug 31, 2020
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.
Projects
None yet
3 participants