-
Notifications
You must be signed in to change notification settings - Fork 1
/
iam.tf
46 lines (34 loc) · 960 Bytes
/
iam.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
####
# Github Actions access
resource "aws_iam_user" "githubactions" {
name = "githubactions"
path = "/system/"
tags = local.default_tags
}
resource "aws_iam_access_key" "githubactions" {
user = aws_iam_user.githubactions.name
}
data "aws_iam_policy_document" "eks_policy" {
statement {
effect = "Allow"
actions = [
"eks:*",
]
resources = [
"*",
]
}
}
resource "aws_iam_policy" "eks_policy" {
name = "AmazonEKSAdminPolicy"
description = "A policy for administration of EKS Clusters and their resources (terraform)"
policy = data.aws_iam_policy_document.eks_policy.json
}
resource "aws_iam_user_policy_attachment" "eks" {
user = aws_iam_user.githubactions.name
policy_arn = aws_iam_policy.eks_policy.arn
}
resource "aws_iam_user_policy_attachment" "ecr" {
user = aws_iam_user.githubactions.name
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser"
}