-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiam_eks.tf
37 lines (27 loc) · 854 Bytes
/
iam_eks.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
data "aws_iam_policy_document" "eks_cluster_role" {
version = "2012-10-17"
statement {
actions = [
"sts:AssumeRole"
]
principals {
type = "Service"
identifiers = [
"eks.amazonaws.com",
"eks-fargate-pods.amazonaws.com"
]
}
}
}
resource "aws_iam_role" "eks_cluster_role" {
name = format("%s-eks-cluster-role", var.cluster_name)
assume_role_policy = data.aws_iam_policy_document.eks_cluster_role.json
}
resource "aws_iam_role_policy_attachment" "eks-cluster-cluster" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
role = aws_iam_role.eks_cluster_role.name
}
resource "aws_iam_role_policy_attachment" "eks-cluster-service" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
role = aws_iam_role.eks_cluster_role.name
}