Why EKS cluster creates a clone of the launch template?

Viewed 152

Our EKS cluster is terraform managed and was specified with EC2 Launch Template as terraform resource. Our aws_eks_node_group includes Launch template section as shown below.

resource "aws_eks_node_group" eks_node_group" {
.........................
..........................
  launch_template {
    id      = aws_launch_template.eksnode_template.id
    version = aws_launch_template.eksnode_template.default_version
    name    = aws_launch_template.eksnode_template.name
  }
}

However, after a while, EKS self-deployed the new Launch Template and linked it to the relevant auto-scaling group.

  1. Why this has happened at the first place and how to avoid it in the future?
  2. How can we link the customer managed Launch Template to EKS Autoscaling Group via terraform again? I tried changing the name or version of the launch template, but it is still using one created by EKS (self-managed)
1 Answers

The Amazon EKS API creates this launch template either by copying one you provide or by creating one automatically with default values in your account.

We don't recommend that you modify auto-generated launch templates.

(source)

Related