Skip to content

Commit b9ce982

Browse files
committed
fix: aws_lambda_function_event_invoke_config
1 parent 0fe683e commit b9ce982

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lambda.tf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ resource "aws_lambda_function" "lambda" {
4848
}
4949
}
5050
}
51-
resource "aws_lambda_function_event_invoke_config" "lambda" {
52-
count = var.s3_bucket_lambda_package != null ? 0 : 1
53-
function_name = aws_lambda_function.lambda.function_name
54-
maximum_event_age_in_seconds = var.maximum_event_age_in_seconds
55-
maximum_retry_attempts = var.maximum_retry_attempts
56-
}
5751

5852
# Note the module must manage the s3 bucket, rather than this be created in the caller then passed in
5953
# It's currently a constraint of Terraform when using the conditional (count hack)
@@ -127,9 +121,8 @@ resource "aws_lambda_function" "lambda_from_s3" {
127121
}
128122
}
129123

130-
resource "aws_lambda_function_event_invoke_config" "lambda_from_s3" {
131-
count = var.s3_bucket_lambda_package != null ? 1 : 0
132-
function_name = aws_lambda_function.lambda_from_s3.function_name
124+
resource "aws_lambda_function_event_invoke_config" "lambda" {
125+
function_name = element(concat(aws_lambda_function.lambda.*.function_name, aws_lambda_function.lambda_from_s3.*.function_name, list("")), 0)
133126
maximum_event_age_in_seconds = var.maximum_event_age_in_seconds
134127
maximum_retry_attempts = var.maximum_retry_attempts
135128
}

0 commit comments

Comments
 (0)