-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
56 lines (51 loc) · 1.46 KB
/
main.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
module "label" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=0.8.0"
namespace = var.namespace
name = var.name
stage = var.stage
delimiter = var.delimiter
attributes = var.attributes
tags = var.tags
enabled = "true"
}
resource "aws_iam_role" "media-convert-execute-role" {
name = "${module.label.namespace}-${module.label.stage}-media-convert-execute-role"
assume_role_policy = data.aws_iam_policy_document.media-convert-execute-assume_role.json
tags = module.label.tags
inline_policy {
name = "media-convert-execute-role"
policy = jsonencode(
{
Statement = [
{
Action = [
"s3:GetObject",
"s3:PutObject",
]
Effect = "Allow"
Resource = [
"${module.video-source.bucket_arn}/*",
"${module.video-cdn.s3_bucket_arn}/*",
]
},
{
Action = "execute-api:Invoke"
Effect = "Allow"
Resource = "arn:aws:execute-api:${var.aws_region}:${var.aws_used_account_no}:*"
},
]
Version = "2012-10-17"
}
)
}
}
data "aws_iam_policy_document" "media-convert-execute-assume_role" {
statement {
actions = ["sts:AssumeRole"]
effect = "Allow"
principals {
type = "Service"
identifiers = ["mediaconvert.amazonaws.com"]
}
}
}