UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

140 lines (139 loc) 5.42 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages an AWS Lambda Function Recursion Config. Use this resource to control how Lambda handles recursive function invocations to prevent infinite loops. * * > **Note:** Destruction of this resource will return the `recursiveLoop` configuration back to the default value of `Terminate`. * * ## Example Usage * * ### Allow Recursive Invocations * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Lambda function that may need to call itself * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "recursive_processor", * role: lambdaRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.Python3d12, * }); * // Allow the function to invoke itself recursively * const exampleFunctionRecursionConfig = new aws.lambda.FunctionRecursionConfig("example", { * functionName: example.name, * recursiveLoop: "Allow", * }); * ``` * * ### Production Safety Configuration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Production function with recursion protection * const productionProcessor = new aws.lambda.Function("production_processor", { * code: new pulumi.asset.FileArchive("processor.zip"), * name: "production-data-processor", * role: lambdaRole.arn, * handler: "app.handler", * runtime: aws.lambda.Runtime.NodeJS20dX, * tags: { * Environment: "production", * Purpose: "data-processing", * }, * }); * // Prevent infinite loops in production * const example = new aws.lambda.FunctionRecursionConfig("example", { * functionName: productionProcessor.name, * recursiveLoop: "Terminate", * }); * ``` * * ## Import * * For backwards compatibility, the following legacy `pulumi import` command is also supported: * * ```sh * $ pulumi import aws:lambda/functionRecursionConfig:FunctionRecursionConfig example recursive_processor * ``` */ export declare class FunctionRecursionConfig extends pulumi.CustomResource { /** * Get an existing FunctionRecursionConfig resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: FunctionRecursionConfigState, opts?: pulumi.CustomResourceOptions): FunctionRecursionConfig; /** * Returns true if the given object is an instance of FunctionRecursionConfig. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is FunctionRecursionConfig; /** * Name of the Lambda function. */ readonly functionName: pulumi.Output<string>; /** * Lambda function recursion configuration. Valid values are `Allow` or `Terminate`. * * The following arguments are optional: */ readonly recursiveLoop: pulumi.Output<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Create a FunctionRecursionConfig resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: FunctionRecursionConfigArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering FunctionRecursionConfig resources. */ export interface FunctionRecursionConfigState { /** * Name of the Lambda function. */ functionName?: pulumi.Input<string>; /** * Lambda function recursion configuration. Valid values are `Allow` or `Terminate`. * * The following arguments are optional: */ recursiveLoop?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; } /** * The set of arguments for constructing a FunctionRecursionConfig resource. */ export interface FunctionRecursionConfigArgs { /** * Name of the Lambda function. */ functionName: pulumi.Input<string>; /** * Lambda function recursion configuration. Valid values are `Allow` or `Terminate`. * * The following arguments are optional: */ recursiveLoop: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; }