-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_role.tf
53 lines (46 loc) · 1.19 KB
/
install_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
51
52
53
data "aws_iam_policy_document" "runner_install" {
statement {
effect = "Allow"
actions = [
"ecs:*",
]
resources = [module.ecs_cluster.cluster_arn, ]
}
statement {
effect = "Allow"
actions = [
"ec2:*",
"ecs:*",
"elasticfilesystem:*",
"iam:PassRole",
"logs:*",
]
resources = ["*"]
}
}
resource "aws_iam_policy" "runner_install" {
name = "${local.prefix}-runner-install"
policy = data.aws_iam_policy_document.runner_install.json
}
data "aws_iam_policy_document" "runner_install_trust" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole", ]
principals {
type = "AWS"
identifiers = [
var.runner_install_role,
]
}
}
}
module "runner_install_iam_role" {
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role"
version = ">= 5.1.0"
create_role = true
role_requires_mfa = false
role_name = "${local.prefix}-runner-install"
create_custom_role_trust_policy = true
custom_role_trust_policy = data.aws_iam_policy_document.runner_install_trust.json
custom_role_policy_arns = [aws_iam_policy.runner_install.arn, ]
}