Skip to content

Commit

Permalink
Merge pull request #10 from constanca-m/fix-dependency-bug
Browse files Browse the repository at this point in the history
[Bug] Fix dependency between configuration and event sources
  • Loading branch information
constanca-m authored Jun 6, 2024
2 parents fdd6ad7 + 06b0b18 commit f70f44b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions esf.tf
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,29 @@ resource "aws_lambda_event_source_mapping" "esf-event-source-mapping-kinesis-dat
function_name = module.esf-lambda-function.lambda_function_arn
starting_position = "TRIM_HORIZON"
enabled = true
depends_on = [module.esf-lambda-function]

# We should wait for the update of the config.yaml
depends_on = [module.esf-lambda-function, aws_s3_object.config-file]
}

resource "aws_lambda_event_source_mapping" "esf-event-source-mapping-sqs" {
for_each = toset(local.sqs-arns)
event_source_arn = each.value
function_name = module.esf-lambda-function.lambda_function_arn
enabled = true
depends_on = [module.esf-lambda-function]

# We should wait for the update of the config.yaml
depends_on = [module.esf-lambda-function, aws_s3_object.config-file]
}

resource "aws_lambda_event_source_mapping" "esf-event-source-mapping-s3-sqs" {
for_each = toset(local.s3-sqs-arns)
event_source_arn = each.value
function_name = module.esf-lambda-function.lambda_function_arn
enabled = true
depends_on = [module.esf-lambda-function]

# We should wait for the update of the config.yaml
depends_on = [module.esf-lambda-function, aws_s3_object.config-file]
}

resource "aws_lambda_permission" "esf-cloudwatch-logs-invoke-function-permission" {
Expand All @@ -252,7 +258,9 @@ resource "aws_cloudwatch_log_subscription_filter" "esf-cloudwatch-log-subscripti
destination_arn = module.esf-lambda-function.lambda_function_arn
filter_pattern = ""
log_group_name = split(":", each.value)[6]
depends_on = [aws_lambda_permission.esf-cloudwatch-logs-invoke-function-permission]

# We should wait for the update of the config.yaml
depends_on = [aws_lambda_permission.esf-cloudwatch-logs-invoke-function-permission, aws_s3_object.config-file]
}

resource "aws_lambda_event_source_mapping" "esf-event-source-mapping-continuing-queue" {
Expand Down

0 comments on commit f70f44b

Please sign in to comment.