-
Notifications
You must be signed in to change notification settings - Fork 1
/
cluster.tf
48 lines (40 loc) · 1.37 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
resource "aws_eks_cluster" "sumologic-demo" {
name = "sumologic-demo"
role_arn = aws_iam_role.sumologic-demo.arn
enabled_cluster_log_types = [
"api",
"audit",
"authenticator",
"controllerManager",
"scheduler"
]
vpc_config {
endpoint_private_access = false
endpoint_public_access = true
subnet_ids = concat([for v in aws_subnet.private : v.id], [for v in aws_subnet.public : v.id])
security_group_ids = [aws_security_group.sumologic-demo-control-plane.id]
}
version = "1.24"
}
data "template_file" "kubeconfig" {
template = file("${path.module}/kubeconfig.tpl")
vars = {
kubeconfig_name = "eks_${aws_eks_cluster.sumologic-demo.name}"
clustername = aws_eks_cluster.sumologic-demo.name
endpoint = aws_eks_cluster.sumologic-demo.endpoint
cluster_auth_base64 = aws_eks_cluster.sumologic-demo.certificate_authority[0].data
}
}
resource "local_file" "kubeconfig" {
content = data.template_file.kubeconfig.rendered
filename = pathexpand("~/.kube/config")
}
resource "aws_eks_fargate_profile" "demo" {
cluster_name = aws_eks_cluster.sumologic-demo.name
fargate_profile_name = "demo"
pod_execution_role_arn = aws_iam_role.sumologic-demo-fargate.arn
subnet_ids = [for v in aws_subnet.private : v.id]
selector {
namespace = "demo"
}
}