-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam_role.tf
50 lines (45 loc) · 1.19 KB
/
iam_role.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
# Provision a role with the minimum IAM policy.
data "aws_iam_policy_document" "warpstream_iam_policy_document_role" {
statement {
effect = "Allow"
actions = [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket"
]
resources = [
aws_s3_bucket.warpstream_bucket.arn,
"${aws_s3_bucket.warpstream_bucket.arn}/*"
]
}
}
resource "aws_iam_policy" "warpstream_iam_policy" {
name = "warpstream-byoc-demo-policy"
policy = data.aws_iam_policy_document.warpstream_iam_policy_document_role.json
}
resource "aws_iam_role" "warpstream_iam_role" {
name = "warpstream-byoc-demo-role"
assume_role_policy = <<EOF
{
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Principal" : {
"AWS" : "arn:aws:iam::767397817548:root"
},
"Action" : "sts:AssumeRole",
"Condition": {}
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "warpstream_iam_policy_attachment" {
role = aws_iam_role.warpstream_iam_role.name
policy_arn = aws_iam_policy.warpstream_iam_policy.arn
}
output "role_arn" {
value = aws_iam_role.warpstream_iam_role.arn
}