import * as pulumi from "@pulumi/pulumi"; /** * Manages a resource-based policy for an AWS Lambda Web function. A resource policy attaches an IAM policy document directly to the function ARN, letting you grant or restrict who may reach the function's endpoints. A common use is locking a function down so that only a specific CloudFront distribution (or another trusted principal) can invoke it, keeping the raw endpoint domain from being reachable directly. * * > **Note:** A resource policy attaches to the parent web function only. Endpoint and revision ARNs (`.../endpoint/`, `.../revision/`) are not accepted. * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambdaweb.ResourcePolicy("example", { * resourceArn: exampleAwsLambdawebFunction.arn, * policy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Sid: "AllowCloudFront", * Effect: "Allow", * Principal: { * Service: "cloudfront.amazonaws.com", * }, * Action: "lambda:InvokeWebFunctionEndpoint", * Resource: exampleAwsLambdawebFunctionEndpoint.arn, * Condition: { * StringEquals: { * "aws:SourceArn": exampleAwsCloudfrontDistribution.arn, * }, * }, * }], * }), * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * - `resourceArn` (String) ARN of the Lambda Web function the policy is attached to. * * Using `pulumi import`, import a Lambda Web resource policy using the function `resourceArn`. For example: * * ```sh * $ pulumi import aws:lambdaweb/resourcePolicy:ResourcePolicy example arn:aws:lambda:us-east-1:123456789012:web-function/example * ``` */ export declare class ResourcePolicy extends pulumi.CustomResource { /** * Get an existing ResourcePolicy 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, state?: ResourcePolicyState, opts?: pulumi.CustomResourceOptions): ResourcePolicy; /** * Check whether an existing ResourcePolicy resource with the given ID exists. * * @param id The _unique_ provider ID of the resource to check. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static exists(id: pulumi.Input, state?: ResourcePolicyState, opts?: pulumi.CustomResourceOptions): pulumi.Output; /** * Returns true if the given object is an instance of ResourcePolicy. 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 ResourcePolicy; /** * Resource-based IAM policy document as JSON. Terraform normalizes the document, so equivalent policies that differ only in key order or whitespace do not produce spurious diffs. */ readonly policy: pulumi.Output; /** * Region where this resource is managed. Defaults to the provider's configured region. */ readonly region: pulumi.Output; /** * ARN of the Lambda Web function the policy is attached to. Must be a web function ARN (`arn:aws:lambda:::web-function/`). Changing this forces a new resource. */ readonly resourceArn: pulumi.Output; /** * Opaque revision identifier for the policy. The service returns a new value on every write; it is used for optimistic concurrency on update and delete. */ readonly revisionId: pulumi.Output; /** * Create a ResourcePolicy 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: ResourcePolicyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ResourcePolicy resources. */ export interface ResourcePolicyState { /** * Resource-based IAM policy document as JSON. Terraform normalizes the document, so equivalent policies that differ only in key order or whitespace do not produce spurious diffs. */ policy?: pulumi.Input; /** * Region where this resource is managed. Defaults to the provider's configured region. */ region?: pulumi.Input; /** * ARN of the Lambda Web function the policy is attached to. Must be a web function ARN (`arn:aws:lambda:::web-function/`). Changing this forces a new resource. */ resourceArn?: pulumi.Input; /** * Opaque revision identifier for the policy. The service returns a new value on every write; it is used for optimistic concurrency on update and delete. */ revisionId?: pulumi.Input; } /** * The set of arguments for constructing a ResourcePolicy resource. */ export interface ResourcePolicyArgs { /** * Resource-based IAM policy document as JSON. Terraform normalizes the document, so equivalent policies that differ only in key order or whitespace do not produce spurious diffs. */ policy: pulumi.Input; /** * Region where this resource is managed. Defaults to the provider's configured region. */ region?: pulumi.Input; /** * ARN of the Lambda Web function the policy is attached to. Must be a web function ARN (`arn:aws:lambda:::web-function/`). Changing this forces a new resource. */ resourceArn: pulumi.Input; } //# sourceMappingURL=resourcePolicy.d.ts.map