Skip to content

Commit

Permalink
feat: Add support for desired_capacity_type (named `desired_size_ty…
Browse files Browse the repository at this point in the history
…pe`) on self-managed node group (#3166)

* set desired_capacity_type

* fix: Add variable with `null` type and pass through node group

---------

Co-authored-by: Bryant Biggs <[email protected]>
  • Loading branch information
dtscssap and bryantbiggs authored Oct 12, 2024
1 parent 159db95 commit 6974a5e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/self-managed-node-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ module "self_managed_node_group" {
| <a name="input_default_instance_warmup"></a> [default\_instance\_warmup](#input\_default\_instance\_warmup) | Amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics. This delay lets an instance finish initializing before Amazon EC2 Auto Scaling aggregates instance metrics, resulting in more reliable usage data | `number` | `null` | no |
| <a name="input_delete_timeout"></a> [delete\_timeout](#input\_delete\_timeout) | Delete timeout to wait for destroying autoscaling group | `string` | `null` | no |
| <a name="input_desired_size"></a> [desired\_size](#input\_desired\_size) | The number of Amazon EC2 instances that should be running in the autoscaling group | `number` | `1` | no |
| <a name="input_desired_size_type"></a> [desired\_size\_type](#input\_desired\_size\_type) | The unit of measurement for the value specified for `desired_size`. Supported for attribute-based instance type selection only. Valid values: `units`, `vcpu`, `memory-mib` | `string` | `null` | no |
| <a name="input_disable_api_termination"></a> [disable\_api\_termination](#input\_disable\_api\_termination) | If true, enables EC2 instance termination protection | `bool` | `null` | no |
| <a name="input_ebs_optimized"></a> [ebs\_optimized](#input\_ebs\_optimized) | If true, the launched EC2 instance will be EBS-optimized | `bool` | `null` | no |
| <a name="input_elastic_gpu_specifications"></a> [elastic\_gpu\_specifications](#input\_elastic\_gpu\_specifications) | The elastic GPU to attach to the instance | `any` | `{}` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/self-managed-node-group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ resource "aws_autoscaling_group" "this" {
default_cooldown = var.default_cooldown
default_instance_warmup = var.default_instance_warmup
desired_capacity = var.desired_size
desired_capacity_type = var.desired_size_type
enabled_metrics = var.enabled_metrics
force_delete = var.force_delete
force_delete_warm_pool = var.force_delete_warm_pool
Expand Down
6 changes: 6 additions & 0 deletions modules/self-managed-node-group/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,12 @@ variable "desired_size" {
default = 1
}

variable "desired_size_type" {
description = "The unit of measurement for the value specified for `desired_size`. Supported for attribute-based instance type selection only. Valid values: `units`, `vcpu`, `memory-mib`"
type = string
default = null
}

variable "ignore_failed_scaling_activities" {
description = "Whether to ignore failed Auto Scaling scaling activities while waiting for capacity."
type = bool
Expand Down
1 change: 1 addition & 0 deletions node_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ module "self_managed_node_group" {
min_size = try(each.value.min_size, var.self_managed_node_group_defaults.min_size, 0)
max_size = try(each.value.max_size, var.self_managed_node_group_defaults.max_size, 3)
desired_size = try(each.value.desired_size, var.self_managed_node_group_defaults.desired_size, 1)
desired_size_type = try(each.value.desired_size_type, var.self_managed_node_group_defaults.desired_size_type, null)
capacity_rebalance = try(each.value.capacity_rebalance, var.self_managed_node_group_defaults.capacity_rebalance, null)
min_elb_capacity = try(each.value.min_elb_capacity, var.self_managed_node_group_defaults.min_elb_capacity, null)
wait_for_elb_capacity = try(each.value.wait_for_elb_capacity, var.self_managed_node_group_defaults.wait_for_elb_capacity, null)
Expand Down

0 comments on commit 6974a5e

Please sign in to comment.