Invokes an AWS Lambda function dynamically based on changes to the environment, using triggers to detect changes.

Terraform Template

resource "aws_lambda_invocation" "example" {
  function_name = "aws_lambda_function.lambda_function_test.function_name"
  input = jsonencode({
 key1 = "value1"
 key2 = "value2"
 })

  triggers = {
    redeployment = sha1(jsonencode([
 aws_lambda_function.example.environment
 ]))
  }
}