-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.tf
59 lines (50 loc) · 1.25 KB
/
user.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
resource "aws_iam_user" "ec2_github_runner" {
name = "${var.resource_prefix}-ec2-github-runner"
}
resource "aws_iam_access_key" "ec2_github_runner" {
user = aws_iam_user.ec2_github_runner.name
}
resource "aws_iam_user_policy" "ec2_github_runner" {
name = "${var.resource_prefix}-ec2-github-runner-user-policy"
user = aws_iam_user.ec2_github_runner.name
policy = data.aws_iam_policy_document.ec2_github_runner.json
}
data "aws_iam_policy_document" "ec2_github_runner" {
statement {
sid = ""
effect = "Allow"
resources = ["*"]
actions = [
"ec2:RunInstances",
"ec2:TerminateInstances",
"ec2:DescribeInstances",
"ec2:DescribeInstanceStatus",
]
}
statement {
sid = ""
effect = "Allow"
resources = ["*"]
actions = [
"ec2:ReplaceIamInstanceProfileAssociation",
"ec2:AssociateIamInstanceProfile",
]
}
statement {
sid = ""
effect = "Allow"
resources = ["*"]
actions = ["iam:PassRole"]
}
statement {
sid = ""
effect = "Allow"
resources = ["*"]
actions = ["ec2:CreateTags"]
condition {
test = "StringEquals"
variable = "ec2:CreateAction"
values = ["RunInstances"]
}
}
}