mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-13 05:45:12 +01:00
feat: Create launch template for Managed Node Groups (#1138)
Signed-off-by: Kevin Lefevre <lefevre.kevin@gmail.com>
This commit is contained in:
@@ -14,13 +14,13 @@ resource "aws_eks_node_group" "workers" {
|
||||
}
|
||||
|
||||
ami_type = lookup(each.value, "ami_type", null)
|
||||
disk_size = lookup(each.value, "disk_size", null)
|
||||
instance_types = lookup(each.value, "instance_types", null)
|
||||
disk_size = each.value["launch_template_id"] != null || each.value["create_launch_template"] ? null : lookup(each.value, "disk_size", null)
|
||||
instance_types = !each.value["set_instance_types_on_lt"] ? each.value["instance_types"] : null
|
||||
release_version = lookup(each.value, "ami_release_version", null)
|
||||
capacity_type = lookup(each.value, "capacity_type", null)
|
||||
|
||||
dynamic "remote_access" {
|
||||
for_each = each.value["key_name"] != "" ? [{
|
||||
for_each = each.value["key_name"] != "" && each.value["launch_template_id"] == null && !each.value["create_launch_template"] ? [{
|
||||
ec2_ssh_key = each.value["key_name"]
|
||||
source_security_group_ids = lookup(each.value, "source_security_group_ids", [])
|
||||
}] : []
|
||||
@@ -43,6 +43,18 @@ resource "aws_eks_node_group" "workers" {
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "launch_template" {
|
||||
for_each = each.value["launch_template_id"] == null && each.value["create_launch_template"] ? [{
|
||||
id = aws_launch_template.workers[each.key].id
|
||||
version = aws_launch_template.workers[each.key].latest_version
|
||||
}] : []
|
||||
|
||||
content {
|
||||
id = launch_template.value["id"]
|
||||
version = launch_template.value["version"]
|
||||
}
|
||||
}
|
||||
|
||||
version = lookup(each.value, "version", null)
|
||||
|
||||
labels = merge(
|
||||
|
||||
Reference in New Issue
Block a user