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 the aws.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());
}
}

Properties

Link copied to clipboard
val functionName: Output<String>

Name of the lambda function.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val input: Output<String>

JSON payload to the lambda function.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val qualifier: Output<String>?

Qualifier (i.e., version) of the lambda function. Defaults to $LATEST.

Link copied to clipboard
val result: Output<String>

String result of the lambda function invocation.

Link copied to clipboard
val triggers: Output<Map<String, String>>?

Map of arbitrary keys and values that, when changed, will trigger a re-invocation.

Link copied to clipboard
val urn: Output<String>