diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6ef8a79bb9..6396765535 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
- rev: v1.48.0
+ rev: v1.50.0
hooks:
- id: terraform_fmt
- id: terraform_docs
diff --git a/README.md b/README.md
index 45b06aaeba..6f680822b1 100644
--- a/README.md
+++ b/README.md
@@ -266,7 +266,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
| [subnets](#input\_subnets) | A list of subnets to place the EKS cluster and workers within. | `list(string)` | n/a | yes |
| [tags](#input\_tags) | A map of tags to add to all resources. Tags added to launch configuration or templates override these values for ASG Tags only. | `map(string)` | `{}` | no |
| [vpc\_id](#input\_vpc\_id) | VPC where the cluster and workers will be deployed. | `string` | n/a | yes |
-| [wait\_for\_cluster\_timeout](#wait\_for\_cluster\_timeout) | Allows for a configurable timeout (in seconds) when waiting for a cluster to come up | `number` | `300` | no |
+| [wait\_for\_cluster\_timeout](#input\_wait\_for\_cluster\_timeout) | A timeout (in seconds) to wait for cluster to be available. | `number` | `300` | no |
| [worker\_additional\_security\_group\_ids](#input\_worker\_additional\_security\_group\_ids) | A list of additional security group ids to attach to worker instances | `list(string)` | `[]` | no |
| [worker\_ami\_name\_filter](#input\_worker\_ami\_name\_filter) | Name filter for AWS EKS worker AMI. If not provided, the latest official AMI for the specified 'cluster\_version' is used. | `string` | `""` | no |
| [worker\_ami\_name\_filter\_windows](#input\_worker\_ami\_name\_filter\_windows) | Name filter for AWS EKS Windows worker AMI. If not provided, the latest official AMI for the specified 'cluster\_version' is used. | `string` | `""` | no |
diff --git a/examples/launch_templates/main.tf b/examples/launch_templates/main.tf
index fe5df294ce..c01256fe58 100644
--- a/examples/launch_templates/main.tf
+++ b/examples/launch_templates/main.tf
@@ -59,6 +59,7 @@ module "eks" {
instance_type = "t3.medium"
asg_desired_capacity = 1
public_ip = true
+ ebs_optimized = true
},
{
name = "worker-group-3"
diff --git a/modules/node_groups/README.md b/modules/node_groups/README.md
index 65fde29883..ab7bb512dd 100644
--- a/modules/node_groups/README.md
+++ b/modules/node_groups/README.md
@@ -25,6 +25,7 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
| desired\_capacity | Desired number of workers | number | `var.workers_group_defaults[asg_desired_capacity]` |
| disk\_size | Workers' disk size | number | Provider default behavior |
| disk\_type | Workers' disk type. Require `create_launch_template` to be `true`| number | `gp3` |
+| ebs\_optimized | Enables/disables EBS optimization. Require `create_launch_template` to be `true` | bool | `true` if defined `instance\_types` are not present in `var.ebs\_optimized\_not\_supported` |
| enable_monitoring | Enables/disables detailed monitoring. Require `create_launch_template` to be `true`| bool | `true` |
| eni_delete | Delete the Elastic Network Interface (ENI) on termination (if set to false you will have to manually delete before destroying) | bool | `true` |
| force\_update\_version | Force version update if existing pods are unable to be drained due to a pod disruption budget issue. | bool | Provider default behavior |
@@ -80,6 +81,7 @@ No modules.
| [cluster\_name](#input\_cluster\_name) | Name of parent cluster | `string` | n/a | yes |
| [create\_eks](#input\_create\_eks) | Controls if EKS resources should be created (it affects almost all resources) | `bool` | `true` | no |
| [default\_iam\_role\_arn](#input\_default\_iam\_role\_arn) | ARN of the default IAM worker role to use if one is not specified in `var.node_groups` or `var.node_groups_defaults` | `string` | n/a | yes |
+| [ebs\_optimized\_not\_supported](#input\_ebs\_optimized\_not\_supported) | List of instance types that do not support EBS optimization | `list(string)` | `[]` | no |
| [ng\_depends\_on](#input\_ng\_depends\_on) | List of references to other resources this submodule depends on | `any` | `null` | no |
| [node\_groups](#input\_node\_groups) | Map of maps of `eks_node_groups` to create. See "`node_groups` and `node_groups_defaults` keys" section in README.md for more details | `any` | `{}` | no |
| [node\_groups\_defaults](#input\_node\_groups\_defaults) | map of maps of node groups to create. See "`node_groups` and `node_groups_defaults` keys" section in README.md for more details | `any` | n/a | yes |
diff --git a/modules/node_groups/launch_template.tf b/modules/node_groups/launch_template.tf
index bdd05b3a2c..eab50b6322 100644
--- a/modules/node_groups/launch_template.tf
+++ b/modules/node_groups/launch_template.tf
@@ -39,6 +39,8 @@ resource "aws_launch_template" "workers" {
}
}
+ ebs_optimized = lookup(each.value, "ebs_optimized", !contains(var.ebs_optimized_not_supported, element(each.value.instance_types, 0)))
+
instance_type = each.value["set_instance_types_on_lt"] ? element(each.value.instance_types, 0) : null
monitoring {
diff --git a/modules/node_groups/locals.tf b/modules/node_groups/locals.tf
index ee026c86d7..89dcd844c4 100644
--- a/modules/node_groups/locals.tf
+++ b/modules/node_groups/locals.tf
@@ -22,6 +22,7 @@ locals {
pre_userdata = var.workers_group_defaults["pre_userdata"]
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
taints = []
+ ebs_optimized = null
},
var.node_groups_defaults,
v,
diff --git a/modules/node_groups/variables.tf b/modules/node_groups/variables.tf
index 585beb5f91..52209e5ef0 100644
--- a/modules/node_groups/variables.tf
+++ b/modules/node_groups/variables.tf
@@ -54,3 +54,9 @@ variable "ng_depends_on" {
type = any
default = null
}
+
+variable "ebs_optimized_not_supported" {
+ description = "List of instance types that do not support EBS optimization"
+ type = list(string)
+ default = []
+}
diff --git a/node_groups.tf b/node_groups.tf
index d98979310f..ec483b8f02 100644
--- a/node_groups.tf
+++ b/node_groups.tf
@@ -9,6 +9,7 @@ module "node_groups" {
tags = var.tags
node_groups_defaults = var.node_groups_defaults
node_groups = var.node_groups
+ ebs_optimized_not_supported = local.ebs_optimized_not_supported
# Hack to ensure ordering of resource creation.
# This is a homemade `depends_on` https://discuss.hashicorp.com/t/tips-howto-implement-module-depends-on-emulation/2305/2