mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-04-29 03:47:43 +02:00
feat: Enable ebs_optimized setting for node_groups (#1459)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
- repo: git://github.com/antonbabenko/pre-commit-terraform
|
||||||
rev: v1.48.0
|
rev: v1.50.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: terraform_fmt
|
- id: terraform_fmt
|
||||||
- id: terraform_docs
|
- id: terraform_docs
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
|
|||||||
| <a name="input_subnets"></a> [subnets](#input\_subnets) | A list of subnets to place the EKS cluster and workers within. | `list(string)` | n/a | yes |
|
| <a name="input_subnets"></a> [subnets](#input\_subnets) | A list of subnets to place the EKS cluster and workers within. | `list(string)` | n/a | yes |
|
||||||
| <a name="input_tags"></a> [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 |
|
| <a name="input_tags"></a> [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 |
|
||||||
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC where the cluster and workers will be deployed. | `string` | n/a | yes |
|
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC where the cluster and workers will be deployed. | `string` | n/a | yes |
|
||||||
| <a name="input_wait_for_cluster_timeout"></a> [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 |
|
| <a name="input_wait_for_cluster_timeout"></a> [wait\_for\_cluster\_timeout](#input\_wait\_for\_cluster\_timeout) | A timeout (in seconds) to wait for cluster to be available. | `number` | `300` | no |
|
||||||
| <a name="input_worker_additional_security_group_ids"></a> [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 |
|
| <a name="input_worker_additional_security_group_ids"></a> [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 |
|
||||||
| <a name="input_worker_ami_name_filter"></a> [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 |
|
| <a name="input_worker_ami_name_filter"></a> [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 |
|
||||||
| <a name="input_worker_ami_name_filter_windows"></a> [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 |
|
| <a name="input_worker_ami_name_filter_windows"></a> [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 |
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ module "eks" {
|
|||||||
instance_type = "t3.medium"
|
instance_type = "t3.medium"
|
||||||
asg_desired_capacity = 1
|
asg_desired_capacity = 1
|
||||||
public_ip = true
|
public_ip = true
|
||||||
|
ebs_optimized = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "worker-group-3"
|
name = "worker-group-3"
|
||||||
|
|||||||
@@ -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]` |
|
| desired\_capacity | Desired number of workers | number | `var.workers_group_defaults[asg_desired_capacity]` |
|
||||||
| disk\_size | Workers' disk size | number | Provider default behavior |
|
| disk\_size | Workers' disk size | number | Provider default behavior |
|
||||||
| disk\_type | Workers' disk type. Require `create_launch_template` to be `true`| number | `gp3` |
|
| 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` |
|
| 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` |
|
| 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 |
|
| 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.
|
|||||||
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of parent cluster | `string` | n/a | yes |
|
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of parent cluster | `string` | n/a | yes |
|
||||||
| <a name="input_create_eks"></a> [create\_eks](#input\_create\_eks) | Controls if EKS resources should be created (it affects almost all resources) | `bool` | `true` | no |
|
| <a name="input_create_eks"></a> [create\_eks](#input\_create\_eks) | Controls if EKS resources should be created (it affects almost all resources) | `bool` | `true` | no |
|
||||||
| <a name="input_default_iam_role_arn"></a> [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 |
|
| <a name="input_default_iam_role_arn"></a> [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 |
|
||||||
|
| <a name="input_ebs_optimized_not_supported"></a> [ebs\_optimized\_not\_supported](#input\_ebs\_optimized\_not\_supported) | List of instance types that do not support EBS optimization | `list(string)` | `[]` | no |
|
||||||
| <a name="input_ng_depends_on"></a> [ng\_depends\_on](#input\_ng\_depends\_on) | List of references to other resources this submodule depends on | `any` | `null` | no |
|
| <a name="input_ng_depends_on"></a> [ng\_depends\_on](#input\_ng\_depends\_on) | List of references to other resources this submodule depends on | `any` | `null` | no |
|
||||||
| <a name="input_node_groups"></a> [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 |
|
| <a name="input_node_groups"></a> [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 |
|
||||||
| <a name="input_node_groups_defaults"></a> [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 |
|
| <a name="input_node_groups_defaults"></a> [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 |
|
||||||
|
|||||||
@@ -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
|
instance_type = each.value["set_instance_types_on_lt"] ? element(each.value.instance_types, 0) : null
|
||||||
|
|
||||||
monitoring {
|
monitoring {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ locals {
|
|||||||
pre_userdata = var.workers_group_defaults["pre_userdata"]
|
pre_userdata = var.workers_group_defaults["pre_userdata"]
|
||||||
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
|
additional_security_group_ids = var.workers_group_defaults["additional_security_group_ids"]
|
||||||
taints = []
|
taints = []
|
||||||
|
ebs_optimized = null
|
||||||
},
|
},
|
||||||
var.node_groups_defaults,
|
var.node_groups_defaults,
|
||||||
v,
|
v,
|
||||||
|
|||||||
@@ -54,3 +54,9 @@ variable "ng_depends_on" {
|
|||||||
type = any
|
type = any
|
||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "ebs_optimized_not_supported" {
|
||||||
|
description = "List of instance types that do not support EBS optimization"
|
||||||
|
type = list(string)
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ module "node_groups" {
|
|||||||
tags = var.tags
|
tags = var.tags
|
||||||
node_groups_defaults = var.node_groups_defaults
|
node_groups_defaults = var.node_groups_defaults
|
||||||
node_groups = var.node_groups
|
node_groups = var.node_groups
|
||||||
|
ebs_optimized_not_supported = local.ebs_optimized_not_supported
|
||||||
|
|
||||||
# Hack to ensure ordering of resource creation.
|
# 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
|
# This is a homemade `depends_on` https://discuss.hashicorp.com/t/tips-howto-implement-module-depends-on-emulation/2305/2
|
||||||
|
|||||||
Reference in New Issue
Block a user