Manages an asynchronous invocation configuration for a Lambda Function or Alias. More information about asynchronous invocations and the configurable values can be found in the Lambda Developer Guide.
resource "aws_lambda_function_event_invoke_config" "example" {
function_name = aws_lambda_alias.example.function_name
destination_config {
on_failure {
destination = aws_sqs_queue.example.arn
}
on_success {
destination = aws_sns_topic.example.arn
}
}
}
resource "aws_lambda_function_event_invoke_config" "example" {
function_name = aws_lambda_alias.example.function_name
maximum_event_age_in_seconds = 60
maximum_retry_attempts = 0
}
resource "aws_lambda_function_event_invoke_config" "example" {
function_name = aws_lambda_alias.example.function_name
qualifier = aws_lambda_alias.example.name
# ... other configuration ...
}
resource "aws_lambda_function_event_invoke_config" "example" {
function_name = aws_lambda_function.example.function_name
qualifier = "$LATEST"
# ... other configuration ...
}
resource "aws_lambda_function_event_invoke_config" "example" {
function_name = aws_lambda_function.example.function_name
qualifier = aws_lambda_function.example.version
# ... other configuration ...
}
The following arguments are required:
function_name
- (Required) Name or Amazon Resource Name (ARN) of the Lambda Function, omitting any version or alias qualifier.The following arguments are optional:
destination_config
- (Optional) Configuration block with destination configuration. See below for details.maximum_event_age_in_seconds
- (Optional) Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600.maximum_retry_attempts
- (Optional) Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2.qualifier
- (Optional) Lambda Function published version, $LATEST
, or Lambda Alias name.The following arguments are optional:
on_failure
- (Optional) Configuration block with destination configuration for failed asynchronous invocations. See below for details.on_success
- (Optional) Configuration block with destination configuration for successful asynchronous invocations. See below for details.The following arguments are required:
destination
- (Required) Amazon Resource Name (ARN) of the destination resource. See the Lambda Developer Guide for acceptable resource types and associated IAM permissions.The following arguments are required:
destination
- (Required) Amazon Resource Name (ARN) of the destination resource. See the Lambda Developer Guide for acceptable resource types and associated IAM permissions.This resource exports the following attributes in addition to the arguments above:
id
- Fully qualified Lambda Function name or Amazon Resource Name (ARN)In Terraform v1.5.0 and later, use an import
block to import Lambda Function Event Invoke Configs using the fully qualified Function name or Amazon Resource Name (ARN). For example:
ARN without qualifier (all versions and aliases):
import {
to = aws_lambda_function_event_invoke_config.example
id = "arn:aws:us-east-1:123456789012:function:my_function"
}
ARN with qualifier:
import {
to = aws_lambda_function_event_invoke_config.example
id = "arn:aws:us-east-1:123456789012:function:my_function:production"
}
Name without qualifier (all versions and aliases):
import {
to = aws_lambda_function_event_invoke_config.example
id = "my_function"
}
Name with qualifier:
import {
to = aws_lambda_function_event_invoke_config.example
id = "my_function:production"
}
Using terraform import
to import Lambda Function Event Invoke Configs using the fully qualified Function name or Amazon Resource Name (ARN). For example:
ARN without qualifier (all versions and aliases):
% terraform import aws_lambda_function_event_invoke_config.example arn:aws:us-east-1:123456789012:function:my_function
ARN with qualifier:
% terraform import aws_lambda_function_event_invoke_config.example arn:aws:us-east-1:123456789012:function:my_function:production
Name without qualifier (all versions and aliases):
% terraform import aws_lambda_function_event_invoke_config.example my_function
Name with qualifier:
% terraform import aws_lambda_function_event_invoke_config.example my_function:production