-
Notifications
You must be signed in to change notification settings - Fork 1
/
iam.tf
43 lines (39 loc) · 1011 Bytes
/
iam.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
resource "aws_iam_role" "janitor" {
name = var.name
assume_role_policy = data.aws_iam_policy_document.assume_role.json
permissions_boundary = var.boundary_policy
}
data "aws_iam_policy_document" "assume_role" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["lambda.amazonaws.com"]
}
}
}
resource "aws_iam_role_policy" "janitor" {
name = "Lambda-Actions"
role = aws_iam_role.janitor.id
policy = data.aws_iam_policy_document.janitor.json
}
data "aws_iam_policy_document" "janitor" {
statement {
sid = "CloudWatchLogs"
actions = [
"logs:CreateLogStream",
"logs:PutLogEvents"
]
resources = ["arn:aws:logs:*:*:*"]
}
statement {
sid = "LambdaActions"
actions = [
"lambda:ListFunctions",
"lambda:ListAliases",
"lambda:ListVersionsByFunction",
"lambda:DeleteFunction",
]
resources = ["*"]
}
}