fix: Fixed launch template version infinite plan issue and improved rolling updates (#1447)

This commit is contained in:
Jaime Hidalgo García
2021-08-25 16:54:29 +02:00
committed by GitHub
parent 4f683ab776
commit d17007b542
4 changed files with 7 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
| subnets | Subnets to contain workers | list(string) | `var.workers_group_defaults[subnets]` |
| version | Kubernetes version | string | Provider default behavior |
| taints | Kubernetes node taints | list(map) | empty |
| update_default_version | Whether or not to set the new launch template version the Default | bool | `true` |
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

View File

@@ -27,7 +27,7 @@ resource "aws_launch_template" "workers" {
name_prefix = local.node_groups_names[each.key]
description = format("EKS Managed Node Group custom LT for %s", local.node_groups_names[each.key])
update_default_version = true
update_default_version = lookup(each.value, "update_default_version", true)
block_device_mappings {
device_name = "/dev/xvda"

View File

@@ -24,6 +24,7 @@ locals {
pre_userdata = var.workers_group_defaults["pre_userdata"]
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
taints = []
update_default_version = true
ebs_optimized = null
},
var.node_groups_defaults,

View File

@@ -47,8 +47,10 @@ 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 = each.value["launch_template_version"]
id = aws_launch_template.workers[each.key].id
version = each.value["launch_template_version"] == "$Latest" ? aws_launch_template.workers[each.key].latest_version : (
each.value["launch_template_version"] == "$Default" ? aws_launch_template.workers[each.key].default_version : each.value["launch_template_version"]
)
}] : []
content {