Skip to content

Commit

Permalink
Merge pull request #6469 from jansepke/patch-1
Browse files Browse the repository at this point in the history
Lambda-Docs: Add logging policy example
  • Loading branch information
bflad authored Dec 2, 2018
2 parents 5416f2e + d5f3ff4 commit 7a37b00
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions website/docs/r/lambda_function.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,38 @@ resource "aws_lambda_function" "test_lambda" {
}
```

## Add permission to write logs to CloudWatch

```HCL
resource "aws_iam_policy" "lambda_logging" {
name = "lambda_logging"
path = "/"
description = "IAM policy for logging from a lambda"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*",
"Effect": "Allow"
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "lambda_logs" {
role = "${aws_iam_role.iam_for_lambda.name}"
policy_arn = "${aws_iam_policy.lambda_logging.arn}"
}
```

## Specifying the Deployment Package

AWS Lambda expects source code to be provided as a deployment package whose structure varies depending on which `runtime` is in use.
Expand Down

0 comments on commit 7a37b00

Please sign in to comment.