Skip to content

Commit c9b377c

Browse files
added EKS
1 parent 9a88548 commit c9b377c

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

eks/eks.tf

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module "eks" {
2+
3+
source = "terraform-aws-modules/eks/aws"
4+
version = "19.15.1"
5+
6+
cluster_name = local.name
7+
cluster_endpoint_public_access = true
8+
9+
cluster_addons = {
10+
coredns = {
11+
most_recent = true
12+
}
13+
kube-proxy = {
14+
most_recent = true
15+
}
16+
vpc-cni = {
17+
most_recent = true
18+
}
19+
}
20+
21+
vpc_id = module.vpc.vpc_id
22+
subnet_ids = module.vpc.private_subnets
23+
control_plane_subnet_ids = module.vpc.intra_subnets
24+
25+
# EKS Managed Node Group(s)
26+
27+
eks_managed_node_group_defaults = {
28+
29+
instance_types = ["t2.medium"]
30+
31+
attach_cluster_primary_security_group = true
32+
33+
}
34+
35+
36+
eks_managed_node_groups = {
37+
38+
bankapp-ng = {
39+
min_size = 2
40+
max_size = 3
41+
desired_size = 2
42+
43+
instance_types = ["t2.medium"]
44+
capacity_type = "SPOT"
45+
46+
tags = {
47+
ExtraTag = "MyCluster"
48+
}
49+
}
50+
}
51+
52+
tags = local.tags
53+
54+
55+
}

eks/provider.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
locals {
2+
3+
region = "us-east-2"
4+
name = "my-eks-cluster"
5+
vpc_cidr = "10.0.0.0/16"
6+
azs = ["us-east-2a", "us-east-2b"]
7+
public_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
8+
private_subnets = ["10.0.3.0/24", "10.0.4.0/24"]
9+
intra_subnets = ["10.0.5.0/24", "10.0.6.0/24"]
10+
tags = {
11+
example = local.name
12+
}
13+
14+
}
15+
16+
provider "aws" {
17+
18+
region = "us-east-2"
19+
20+
}

eks/vpc.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module "vpc" {
2+
3+
source = "terraform-aws-modules/vpc/aws"
4+
version = "~> 4.0"
5+
6+
name = local.name
7+
cidr = local.vpc_cidr
8+
azs = local.azs
9+
public_subnets = local.public_subnets
10+
private_subnets = local.private_subnets
11+
intra_subnets = local.intra_subnets
12+
13+
enable_nat_gateway = true
14+
15+
public_subnet_tags = {
16+
"kubernetes.io/role/elb" = 1
17+
}
18+
19+
private_subnet_tags = {
20+
"kubernetes.io/role/internal-elb" = 1
21+
}
22+
23+
}

0 commit comments

Comments
 (0)