-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws_iam_role.ih-tf-github-control.tf
57 lines (51 loc) · 1.47 KB
/
aws_iam_role.ih-tf-github-control.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
## Data Sources
data "aws_iam_policy_document" "ih-tf-github-control-assume" {
statement {
sid = "000"
actions = ["sts:AssumeRoleWithWebIdentity"]
principals {
type = "Federated"
identifiers = [
"arn:aws:iam::289256138624:oidc-provider/token.actions.githubusercontent.com"
]
}
condition {
test = "StringEquals"
variable = "token.actions.githubusercontent.com:aud"
values = [
"sts.amazonaws.com"
]
}
condition {
test = "StringLike"
variable = "token.actions.githubusercontent.com:sub"
values = [
"repo:infrahouse8/github-control:*"
]
}
}
statement {
sid = "010"
actions = ["sts:AssumeRole"]
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::990466748045:user/aleks"
]
}
}
}
## EOF Data Sources
# IAM role ih-tf-github-control
resource "aws_iam_role" "ih-tf-github-control" {
provider = aws.aws-289256138624-uw1
name = "ih-tf-github-control"
description = "Terraform Applier for github-control repo"
assume_role_policy = data.aws_iam_policy_document.ih-tf-github-control-assume.json
}
# TODO: GitHub user doesn't really need Admin permissions
resource "aws_iam_role_policy_attachment" "ih-tf-github-control" {
provider = aws.aws-289256138624-uw1
policy_arn = data.aws_iam_policy.administrator-access.arn
role = aws_iam_role.ih-tf-github-control.name
}