Skip to content

Commit

Permalink
Refactor main.tf: Update instance type and block device mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlahbib committed Nov 16, 2024
1 parent 1c213c7 commit cf9db4e
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,18 @@ resource "aws_iam_instance_profile" "eks_instance_profile" {
}

resource "aws_launch_template" "eks_launch_template" {
block_device_mappings {
device_name = "/dev/xvda"
ebs {
delete_on_termination = true
volume_size = 20
volume_type = "gp2"
}
}

iam_instance_profile {
name = aws_iam_instance_profile.eks_instance_profile.name
}
image_id = data.aws_ami.node-image.id
instance_type = "t3.micro"

Expand Down Expand Up @@ -95,16 +106,27 @@ resource "aws_eks_node_group" "eks_node_group" {
node_group_name = "eks-node-group"
node_role_arn = aws_iam_role.worker_role.arn
subnet_ids = module.vpc.private_subnets
desired_size = 2
min_size = 1
max_size = 3

vpc_zone_identifier = module.vpc.subnet_zones[0]

launch_template {
id = aws_launch_template.eks_launch_template.id
version = "$Latest"
}

scaling_config {
desired_size = 2
max_size = 3
min_size = 1
tag {
key = "Name"
value = "${aws_eks_cluster.eks_cluster.name}-node"
propagate_at_launch = true
}

tag {
key = "kubernetes.io/cluster/${aws_eks_cluster.eks_cluster.name}"
value = "owned"
propagate_at_launch = true
}

depends_on = [aws_eks_cluster.eks_cluster]
Expand Down

0 comments on commit cf9db4e

Please sign in to comment.