diff --git a/README.md b/README.md index 1165ac3..4257ba1 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,7 @@ _Note: Since this module manages all of the Kubernetes addon dependencies requir | [node\_pool\_ami\_id](#input\_node\_pool\_ami\_id) | The AMI ID to use for the EKS cluster nodes. Defaults to the latest EKS Optimized AMI provided by AWS. | `string` | `""` | no | | [node\_pool\_azs](#input\_node\_pool\_azs) | A list of availability zones to use for the EKS node group. If not set, the module will use the same availability zones with the cluster. | `list(string)` | `[]` | no | | [node\_pool\_block\_device\_name](#input\_node\_pool\_block\_device\_name) | The name of the block device to use for the EKS cluster nodes. | `string` | `"/dev/nvme0n1"` | no | +| [node\_pool\_capacity\_type](#input\_node\_pool\_capacity\_type) | The capacity type for the node group. | `string` | `ON_DEMAND` | no | | [node\_pool\_desired\_size](#input\_node\_pool\_desired\_size) | Desired number of worker nodes in the node pool. | `number` | `0` | no | | [node\_pool\_disk\_iops](#input\_node\_pool\_disk\_iops) | The amount of provisioned IOPS for the worker node root EBS volume. | `number` | `3000` | no | | [node\_pool\_disk\_size](#input\_node\_pool\_disk\_size) | Disk size in GiB for worker nodes in the node pool. Defaults to 50. | `number` | `100` | no | diff --git a/main.tf b/main.tf index 70b0313..5b49c04 100644 --- a/main.tf +++ b/main.tf @@ -109,6 +109,7 @@ locals { desired_size = var.node_pool_desired_size ebs_optimized = var.node_pool_ebs_optimized enable_monitoring = var.enable_node_pool_monitoring + capacity_type = var.node_pool_capacity_type min_size = var.node_pool_min_size max_size = var.node_pool_max_size pre_bootstrap_user_data = var.node_pool_pre_userdata @@ -127,6 +128,7 @@ locals { for i, j in data.aws_subnet.private_subnets : { subnet_ids = [data.aws_subnet.private_subnets[i].id] instance_types = [instance_type] + capacity_type = var.node_pool_capacity_type name = "snc-${split(".", instance_type)[1]}-${data.aws_subnet.private_subnets[i].availability_zone}" use_name_prefix = true taints = {} @@ -151,6 +153,7 @@ locals { "snc-core" = { subnet_ids = local.node_group_subnet_ids instance_types = [var.v3_node_group_core_instance_type] + capacity_type = var.node_pool_capacity_type name = "snc-core" use_name_prefix = true taints = local.v3_node_taints diff --git a/variables.tf b/variables.tf index 937dbe9..00cdb95 100644 --- a/variables.tf +++ b/variables.tf @@ -471,6 +471,13 @@ variable "node_pool_block_device_name" { type = string } +variable "node_pool_capacity_type" { + description = "The capacity type for the node group. Defaults to \"ON_DEMAND\". If set to \"SPOT\", the node group will be a spot instance node group." + type = string + default = "ON_DEMAND" + +} + variable "node_pool_desired_size" { default = 0 description = "Desired number of worker nodes in the node pool."