feat: Define Root device name for Windows self-managed worker groups (#1401)

NOTES: Since we now search only for Linux or Windows AMI if there is a worker groups for the corresponding plateform, we can now define different default root block device name for each plateform. Use locals `root_block_device_name` and `root_block_device_name_windows` to define your owns.
This commit is contained in:
Thierno IB. BARRY
2021-05-28 10:35:51 +02:00
committed by GitHub
parent d7630ef632
commit fcc2fdc993
2 changed files with 12 additions and 11 deletions

View File

@@ -78,7 +78,8 @@ locals {
warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group. warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group.
# Settings for launch templates # Settings for launch templates
root_block_device_name = concat(data.aws_ami.eks_worker.*.root_device_name, [""])[0] # Root device name for workers. If non is provided, will assume default AMI was used. root_block_device_name = concat(data.aws_ami.eks_worker.*.root_device_name, [""])[0] # Root device name for Linux workers. If not provided, will assume default Linux AMI was used.
root_block_device_name_windows = concat(data.aws_ami.eks_worker_windows.*.root_device_name, [""])[0] # Root device name for Windows workers. If not provided, will assume default Windows AMI was used.
root_kms_key_id = "" # The KMS key to use when encrypting the root storage device root_kms_key_id = "" # The KMS key to use when encrypting the root storage device
launch_template_id = null # The id of the launch template used for managed node_groups launch_template_id = null # The id of the launch template used for managed node_groups
launch_template_version = "$Latest" # The latest version of the launch template to use in the autoscaling group launch_template_version = "$Latest" # The latest version of the launch template to use in the autoscaling group

View File

@@ -438,7 +438,7 @@ resource "aws_launch_template" "workers_launch_template" {
device_name = lookup( device_name = lookup(
var.worker_groups_launch_template[count.index], var.worker_groups_launch_template[count.index],
"root_block_device_name", "root_block_device_name",
local.workers_group_defaults["root_block_device_name"], lookup(var.worker_groups_launch_template[count.index], "platform", local.workers_group_defaults["platform"]) == "windows" ? local.workers_group_defaults["root_block_device_name_windows"] : local.workers_group_defaults["root_block_device_name"],
) )
ebs { ebs {