forked from MithunTechnologiesDevOps/EKS-Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheks-cluster.tf
33 lines (25 loc) · 871 Bytes
/
eks-cluster.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
resource "aws_eks_cluster" "main" {
name = "${var.project_name}-cluster"
role_arn = aws_iam_role.cluster.arn
#version = "1.24"
vpc_config {
subnet_ids = flatten([aws_subnet.public[*].id, aws_subnet.private[*].id])
endpoint_public_access = true
endpoint_private_access = true
public_access_cidrs = ["0.0.0.0/0"]
}
tags = merge(var.common_tags, {
"Name" = "${var.project_name}-cluster"
})
depends_on = [
aws_iam_role_policy_attachment.cluster_policy_attach
]
}
resource "aws_iam_role" "cluster" {
name = "${var.project_name}-cluster-role"
assume_role_policy = data.aws_iam_policy_document.assume_role.json
}
resource "aws_iam_role_policy_attachment" "cluster_policy_attach" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
role = aws_iam_role.cluster.name
}