Skip to content

Commit

Permalink
Rolling back to asg
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDiazL committed Dec 19, 2023
1 parent 2d324e5 commit b7fcbcc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
102 changes: 51 additions & 51 deletions operations/deployment/terraform/modules/aws/eks/aws_eks_cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ data "aws_eks_cluster_auth" "cluster_auth" {
}

resource "aws_launch_template" "main" {
#network_interfaces {
# associate_public_ip_address = true
#security_groups = [aws_security_group.eks_security_group_worker.id]
#}
vpc_security_group_ids = [aws_security_group.eks_security_group_worker.id]
network_interfaces {
associate_public_ip_address = true
security_groups = [aws_security_group.eks_security_group_worker.id]
}
#vpc_security_group_ids = [aws_security_group.eks_security_group_worker.id]
iam_instance_profile {
# name = aws_iam_instance_profile.eks_inst_profile.name
name = aws_iam_instance_profile.eks_inst_profile.name
}
image_id = var.aws_eks_instance_ami_id != "" ? var.aws_eks_instance_ami_id : data.aws_ami.image_selected.id
instance_type = var.aws_eks_instance_type
Expand Down Expand Up @@ -130,63 +130,63 @@ locals {
USERDATA
}

#resource "aws_autoscaling_group" "main" {
# desired_capacity = var.aws_eks_desired_capacity
# launch_template {
# id = aws_launch_template.main.id
# version = "${aws_launch_template.main.latest_version}"
# }
# max_size = var.aws_eks_max_size
# min_size = var.aws_eks_min_size
# name = "${var.aws_resource_identifier}-${var.aws_eks_environment}-eksworker-asg"
# vpc_zone_identifier = data.aws_subnets.private.ids
# health_check_type = "EC2"
#
#tag {
# key = "Name"
# value = "${var.aws_resource_identifier}-${var.aws_eks_environment}-eksworker-node"
# propagate_at_launch = true
#}
#
# depends_on = [
# aws_iam_role.iam_role_master,
# aws_iam_role.iam_role_worker,
# aws_security_group.eks_security_group_master,
# aws_security_group.eks_security_group_worker
# ]
#}

resource "aws_eks_node_group" "worker_nodes" {
cluster_name = aws_eks_cluster.main.name
node_group_name = "${var.aws_resource_identifier}-ng"
node_role_arn = aws_iam_role.iam_role_worker.arn
subnet_ids = data.aws_subnets.private.ids

scaling_config {
desired_size = var.aws_eks_desired_capacity
max_size = var.aws_eks_max_size
min_size = var.aws_eks_min_size
}

update_config {
max_unavailable = 1
}

resource "aws_autoscaling_group" "main" {
desired_capacity = var.aws_eks_desired_capacity
launch_template {
id = aws_launch_template.main.id
version = "${aws_launch_template.main.latest_version}"
}
max_size = var.aws_eks_max_size
min_size = var.aws_eks_min_size
name = "${var.aws_resource_identifier}-${var.aws_eks_environment}-eksworker-asg"
vpc_zone_identifier = data.aws_subnets.private.ids
health_check_type = "EC2"

tag {
key = "Name"
value = "${var.aws_resource_identifier}-${var.aws_eks_environment}-eksworker-node"
propagate_at_launch = true
}

depends_on = [
aws_iam_role.iam_role_worker,
aws_iam_role.iam_role_master,
aws_eks_cluster.main,
aws_launch_template.main,
aws_iam_role.iam_role_worker,
aws_security_group.eks_security_group_master,
aws_security_group.eks_security_group_worker
]
}

#resource "aws_eks_node_group" "worker_nodes" {
# cluster_name = aws_eks_cluster.main.name
# node_group_name = "${var.aws_resource_identifier}-ng"
# node_role_arn = aws_iam_role.iam_role_worker.arn
# subnet_ids = data.aws_subnets.private.ids
#
# scaling_config {
# desired_size = var.aws_eks_desired_capacity
# max_size = var.aws_eks_max_size
# min_size = var.aws_eks_min_size
# }
#
# update_config {
# max_unavailable = 1
# }
#
# launch_template {
# id = aws_launch_template.main.id
# version = "${aws_launch_template.main.latest_version}"
# }
#
# depends_on = [
# aws_iam_role.iam_role_worker,
# aws_iam_role.iam_role_master,
# aws_eks_cluster.main,
# aws_launch_template.main,
# aws_security_group.eks_security_group_master,
# aws_security_group.eks_security_group_worker
# ]
#}

output "aws_eks_cluster_name" {
value = aws_eks_cluster.main.name
}
Expand Down
12 changes: 6 additions & 6 deletions operations/deployment/terraform/modules/aws/eks/aws_eks_iam.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#resource "aws_iam_instance_profile" "eks_inst_profile" {
# name = "${var.aws_resource_identifier}-eks-inst-profile"
# path = "/"
# role = aws_iam_role.iam_role_worker.id
# depends_on = [aws_iam_role.iam_role_worker]
# }
resource "aws_iam_instance_profile" "eks_inst_profile" {
name = "${var.aws_resource_identifier}-eks-inst-profile"
path = "/"
role = aws_iam_role.iam_role_worker.id
depends_on = [aws_iam_role.iam_role_worker]
}

resource "aws_iam_role" "iam_role_master" {
name = "${var.aws_resource_identifier}-eks-master"
Expand Down

0 comments on commit b7fcbcc

Please sign in to comment.