forked from AlexsLemonade/refinebio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.tf
112 lines (101 loc) · 2.68 KB
/
users.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
resource "aws_iam_access_key" "data_refinery_user_client_key" {
user = "${aws_iam_user.data_refinery_user_client.name}"
}
resource "aws_iam_access_key" "data-refinery-deployer-access-key" {
user = "${aws_iam_user.data-refinery-deployer.name}"
}
resource "aws_iam_user" "data_refinery_user_client" {
name = "data-refinery-user-client-${var.user}-${var.stage}"
}
resource "aws_iam_user" "data-refinery-deployer" {
name = "data-refinery-deployer-${var.user}-${var.stage}"
}
# XXX: TODO: Lock these down!!!!
resource "aws_iam_user_policy" "data_refinery_user_client_policy" {
name = "data-refinery-user-client-key-${var.user}-${var.stage}"
user = "${aws_iam_user.data_refinery_user_client.name}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:PutLogEvents",
"logs:DescribeLogStreams"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": [
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics",
"cloudwatch:PutMetricAlarm",
"cloudwatch:PutMetricData",
"cloudwatch:SetAlarmState"
],
"Resource":
"*"
},
{
"Effect": "Allow",
"Action":[
"SES:SendEmail",
"SES:SendRawEmail"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action":[
"ec2:DescribeVolumes",
"ec2:AttachVolume"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action":[
"es:*"
],
"Resource": "*"
}
]
}
EOF
}
data "aws_iam_policy_document" "data-refinery-deployment" {
statement {
actions = [
"s3:ListObjects",
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject",
"s3:PutObjectAcl",
]
resources = [
"arn:aws:s3:::${aws_s3_bucket.data-refinery-static.id}/*",
]
}
statement {
actions = [
"s3:ListBucket"
]
resources = [
"arn:aws:s3:::${aws_s3_bucket.data-refinery-static.id}",
]
}
}
resource "aws_iam_user_policy" "data-refinery-deployer" {
name = "data-refinery-deployer-${var.user}-${var.stage}"
user = "${aws_iam_user.data-refinery-deployer.name}"
policy = "${data.aws_iam_policy_document.data-refinery-deployment.json}"
}