-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheks_admin_role.tf
48 lines (45 loc) · 1.16 KB
/
eks_admin_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
resource "aws_iam_role" "eks_admin_role" {
name = "${var.eks_cluster_name}-eks-admin-role"
assume_role_policy = <<EOF
{
"Version" : "2012-10-17",
"Statement" : [
{
"Action" : "sts:AssumeRole",
"Principal": {
"AWS": "arn:aws:iam::${local.account_id}:root"
},
"Effect" : "Allow"
}
]
}
EOF
tags = var.default_tags
}
resource "aws_iam_policy" "eks_admin_role_policy" {
name = "eks_admin_role_policy_${var.eks_cluster_name}"
description = "EKS Admin role policy for cluster ${var.eks_cluster_name}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"eks:*",
"iam:ListRoles"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "eks_admin_role_policy_attachment" {
role = aws_iam_role.eks_admin_role.name
policy_arn = aws_iam_policy.eks_admin_role_policy.arn
}
# resource "aws_iam_group_policy_attachment" "eks_admin_group_policy_attachment" {
# group = "eks-administrators"
# policy_arn = aws_iam_policy.eks_admin_role_policy.arn
# }