-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpermissions.tf
91 lines (79 loc) · 2.12 KB
/
permissions.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
resource "aws_iam_policy" "byos_object_permissions_policy" {
name = "FirefliesAI_BYOS_Object_Permissions"
description = "Fireflies AI BYOS Object Permissions Policy"
policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Action = [
"s3:PutObject",
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucket",
"s3:PutObjectAcl",
],
Resource = [
"arn:aws:s3:::${var.bucket_name}/*",
],
},
],
})
}
resource "aws_iam_policy" "bucket_permissions_policy" {
name = "FirefliesAI_BYOS_Bucket_Permissions"
description = "Fireflies AI BYOS Bucket Permissions Policy"
policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Action = [
"s3:ListBucket",
"s3:GetBucketAcl",
"s3:GetBucketPolicy",
],
Resource = [
# "arn:aws:s3:::${var.bucket_name}",
"*",
],
},
],
})
}
resource "aws_iam_role" "bucket_permissions" {
name = "firefliesai_aws_byos_bucket_role"
assume_role_policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Principal = {
AWS = [
"arn:aws:iam::466023587921:root",
"arn:aws:iam::466023587921:user/rtmp-server-user-0",
],
},
Action = "sts:AssumeRole",
},
],
})
}
resource "aws_iam_role_policy_attachment" "bucket_permissions_attachment" {
policy_arn = aws_iam_policy.bucket_permissions_policy.arn
role = aws_iam_role.bucket_permissions.name
}
resource "aws_iam_role_policy_attachment" "byos_object_permissions_attachment" {
policy_arn = aws_iam_policy.byos_object_permissions_policy.arn
role = aws_iam_role.bucket_permissions.name
}
output "role_arn" {
value = aws_iam_role.bucket_permissions.arn
}
output "bucket_name" {
value = aws_s3_bucket.fireflies-ai-aws-byos-bucket.id
}
output "bucket_region" {
value = aws_s3_bucket.fireflies-ai-aws-byos-bucket.region
}