forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiam-policies.tf
More file actions
52 lines (47 loc) 路 1.39 KB
/
Copy pathiam-policies.tf
File metadata and controls
52 lines (47 loc) 路 1.39 KB
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
44
45
46
47
48
49
50
51
52
resource "aws_iam_policy" "lambda_basic" {
name = "${var.project_name}-${var.environment}-lambda-basic"
description = "Least privilege policy for Lambda functions"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
]
Resource = "arn:aws:logs:${var.region}:*:log-group:/aws/lambda/${var.project_name}-${var.environment}-*"
},
{
Effect = "Allow"
Action = [
"ec2:CreateNetworkInterface",
"ec2:DescribeNetworkInterfaces",
"ec2:DeleteNetworkInterface"
]
Resource = "*"
}
]
})
tags = { Environment = var.environment, Project = var.project_name }
}
resource "aws_iam_policy" "ec2_ssm" {
name = "${var.project_name}-${var.environment}-ec2-ssm"
description = "Allow EC2 instances to use SSM Session Manager"
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = [
"ssm:UpdateInstanceInformation",
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
]
Resource = "*"
}]
})
tags = { Environment = var.environment, Project = var.project_name }
}