Invocation
Use this resource to invoke a lambda function. The lambda function is invoked with the RequestResponse invocation type.
NOTE: This resource only invokes the function when the arguments call for a create or update. In other words, after an initial invocation on apply, if the arguments do not change, a subsequent apply does not invoke the function again. To dynamically invoke the function, see the
triggers
example below. To always invoke a function on each apply, see theaws.lambda.Invocation
data source.
Example Usage
Dynamic Invocation Example Using Triggers
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.Invocation;
import com.pulumi.aws.lambda.InvocationArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Invocation("example", InvocationArgs.builder()
.functionName(aws_lambda_function.lambda_function_test().function_name())
.triggers(Map.of("redeployment", computeSHA1(serializeJson(
jsonArray(aws_lambda_function.example().environment())))))
.input(serializeJson(
jsonObject(
jsonProperty("key1", "value1"),
jsonProperty("key2", "value2")
)))
.build());
}
}
Content copied to clipboard