forked from anmolnagpal/terraform-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam.tf
47 lines (40 loc) · 1.62 KB
/
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
46
47
###____ _ _ _ ____ _____ _____ ____
##/ ___| | | | | / ___|_ _| ____| _ \
#| | | | | | | \___ \ | | | _| | |_) |
#| |___| |__| |_| |___) || | | |___| _ <
#\____|_____\___/|____/ |_| |_____|_| \_\
resource "aws_iam_role" "eks-cluster" {
name = "eks-cluster"
path = "./"
assume_role_policy = "${file("./json/cluster-role-policy.json")}"
}
resource "aws_iam_role_policy_attachment" "k8s-cluster-AmazonEKSClusterPolicy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
role = "${aws_iam_role.eks-cluster.name}"
}
resource "aws_iam_role_policy_attachment" "k8s-cluster-AmazonEKSServicePolicy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
role = "${aws_iam_role.eks-cluster.name}"
}
###_ _ ___ ____ _____ ____
##| \ | |/ _ \| _ \| ____/ ___|
##| \| | | | | | | | _| \___ \
##| |\ | |_| | |_| | |___ ___) |
##|_| \_|\___/|____/|_____|____/
resource "aws_iam_role" "eks-node" {
name = "eks-node"
path = "./"
assume_role_policy = "${file("./json/node-role-policy.json")}"
}
resource "aws_iam_role_policy_attachment" "eks-node-AmazonEKSWorkerNodePolicy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy"
role = "${aws_iam_role.eks-node.name}"
}
resource "aws_iam_role_policy_attachment" "eks-node-AmazonEKS_CNI_Policy" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy"
role = "${aws_iam_role.eks-node.name}"
}
resource "aws_iam_role_policy_attachment" "eks-node-AmazonEC2ContainerRegistryReadOnly" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
role = "${aws_iam_role.eks-node.name}"
}