-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheks.tf
46 lines (35 loc) · 999 Bytes
/
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
38
39
40
41
42
43
44
45
46
resource "aws_iam_role" "iam-eks-cluster" {
name = var.iam_eks_cluster_name
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [ "eks.amazonaws.com", "ec2.amazonaws.com", "acm.amazonaws.com" ]
},
"Action": "sts:AssumeRole"
}
]
}
POLICY
}
resource "aws_iam_role_policy_attachment" "iam-policy-eks-cluster" {
count = length(var.iam_eks_cluster_policy_arn)
policy_arn = var.iam_eks_cluster_policy_arn[count.index]
role = aws_iam_role.iam-eks-cluster.name
}
# CLUSTER
resource "aws_eks_cluster" "eks" {
name = var.cluster_name
role_arn = aws_iam_role.iam-eks-node.arn
enabled_cluster_log_types = var.eks_cluster_log_types
vpc_config {
security_group_ids = [aws_security_group.security-group-cluster.id]
subnet_ids = aws_subnet.subnet.*.id
}
depends_on = [
aws_iam_role_policy_attachment.iam-policy-eks-node
]
}