From c51eb5c4dc700671cd62b2b60dea685c1c8642a0 Mon Sep 17 00:00:00 2001 From: Tarashish Mishra Date: Fri, 13 Dec 2024 09:35:30 +0530 Subject: [PATCH] use custom launch template to set storage size --- terraform/resources/eks.tf | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/terraform/resources/eks.tf b/terraform/resources/eks.tf index b0e9338..8aa0d6f 100644 --- a/terraform/resources/eks.tf +++ b/terraform/resources/eks.tf @@ -62,7 +62,6 @@ module "eks" { eks_managed_node_group_defaults = { ami_type = "AL2023_x86_64_STANDARD" - disk_size = 100 } eks_managed_node_groups = { @@ -75,6 +74,19 @@ module "eks" { max_size = 1 desired_size = 0 + # Launch template configuration + use_custom_launch_template = true + block_device_mappings = { + xvda = { + device_name = "/dev/xvda" + ebs = { + volume_size = 100 + volume_type = "gp3" + delete_on_termination = true + } + } + } + # Needed by the aws-ebs-csi-driver iam_role_additional_policies = { AmazonEBSCSIDriverPolicy = "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy" @@ -89,7 +101,19 @@ module "eks" { min_size = 1 max_size = 2 desired_size = 1 - disk_size = 100 + + # Launch template configuration + use_custom_launch_template = true + block_device_mappings = { + xvda = { + device_name = "/dev/xvda" + ebs = { + volume_size = 100 + volume_type = "gp3" + delete_on_termination = true + } + } + } # Needed by the aws-ebs-csi-driver iam_role_additional_policies = {