diff --git a/website/source/docs/providers/aws/r/lambda_permission.html.markdown b/website/source/docs/providers/aws/r/lambda_permission.html.markdown new file mode 100644 index 000000000..0df4112a5 --- /dev/null +++ b/website/source/docs/providers/aws/r/lambda_permission.html.markdown @@ -0,0 +1,123 @@ +--- +layout: "aws" +page_title: "AWS: aws_lambda_permission" +sidebar_current: "docs-aws-resource-aws-lambda-permission" +description: |- + Creates a Lambda function permission. +--- + +# aws\_lambda\_permission + +Creates a Lambda permission to allow external sources invoking the Lambda function +(e.g. CloudWatch Event Rule, SNS or S3). + +## Example Usage + +``` +resource "aws_lambda_permission" "allow_cloudwatch" { + statement_id = "AllowExecutionFromCloudWatch" + action = "lambda:InvokeFunction" + function_name = "${aws_lambda_function.test_lambda.arn}" + principal = "events.amazonaws.com" + source_account = "111122223333" + source_arn = "arn:aws:events:eu-west-1:111122223333:rule/RunDaily" + qualifier = "${aws_lambda_alias.test_alias.name}" +} + +resource "aws_lambda_alias" "test_alias" { + name = "testalias" + description = "a sample description" + function_name = "${aws_lambda_function.test_lambda.arn}" + function_version = "$LATEST" +} + +resource "aws_lambda_function" "test_lambda" { + filename = "lambdatest.zip" + function_name = "lambda_function_name" + role = "${aws_iam_role.iam_for_lambda.arn}" + handler = "exports.handler" +} + +resource "aws_iam_role" "iam_for_lambda" { + name = "iam_for_lambda" + assume_role_policy = <> aws_lambda_event_source_mapping + > + aws_lambda_permission +