Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for desired_capacity_type (named desired_size_type) on self-managed node group #3166

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

dtscssap
Copy link
Contributor

@dtscssap dtscssap commented Sep 26, 2024

Description

  • sets the desired_capacity_type for the aws_autoscaling_group resource to AWS default value "units"

Motivation and Context

  • current implementation succeeds with leaving this attribute undefined which AWS will set to its default "units" on their end, but evidently subsequent runs of Terraform don't see this during a refresh of state
    • if a user goes into the AWS Console and edits the Autoscaling Group (changes nothing, just clicks the Save button), Terraform will suddenly see this attribute when it refreshes state 🤦

    • if this happens, you will have no choice but to destroy the autoscaling group and recreate via the Terraform because without this change there is no way to tell the current module to not try to set the desired_capacity_type = "units" -> null

        # module.eks_al2.module.self_managed_node_group["example"].aws_autoscaling_group.this will be updated in-place
        ~ resource "aws_autoscaling_group" "this" {
            - desired_capacity_type            = "units" -> null
              id                               = "example"
              name                             = "example"
              # (26 unchanged attributes hidden)
      
              # (39 unchanged blocks hidden)
          }
      
      Plan: 0 to add, 1 to change, 0 to destroy.
      
      Do you want to perform these actions?
        Terraform will perform the actions described above.
        Only 'yes' will be accepted to approve.
      
        Enter a value: yes
      
      module.eks_al2.module.self_managed_node_group["example"].aws_autoscaling_group.this: Modifying... [id=<redacted>]
      ╷
      │ Error: updating Auto Scaling Group (example): InvalidParameter: 1 validation error(s) found.
      │ - minimum field size of 1, UpdateAutoScalingGroupInput.DesiredCapacityType.
      │ 
      

Breaking Changes

  • no, "units" is the default value

How Has This Been Tested?

  • [ X ] I have updated at least one of the examples/* to demonstrate and validate my change(s)
    • I have not as there is nothing to show, this is a value that is being set under the hood
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@dtscssap dtscssap changed the title set desired_capacity_type fix: set desired_capacity_type Sep 26, 2024
@dtscssap dtscssap changed the title fix: set desired_capacity_type fix: Set desired_capacity_type Sep 26, 2024
@dtscssap dtscssap changed the title fix: Set desired_capacity_type fix: Set desired_capacity_type Sep 26, 2024
@@ -497,6 +497,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 = "units"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create var.desired_capacity_type and make "units" as a default value

@bryantbiggs bryantbiggs changed the title fix: Set desired_capacity_type feat: Add support for desired_capacity_type (named desired_size_type) Oct 12, 2024
@bryantbiggs bryantbiggs changed the title feat: Add support for desired_capacity_type (named desired_size_type) feat: Add support for desired_capacity_type (named desired_size_type) on self-managed node group Oct 12, 2024
@bryantbiggs bryantbiggs merged commit 6974a5e into terraform-aws-modules:master Oct 12, 2024
19 checks passed
antonbabenko pushed a commit that referenced this pull request Oct 12, 2024
## [20.26.0](v20.25.0...v20.26.0) (2024-10-12)

### Features

* Add support for `desired_capacity_type` (named `desired_size_type`) on self-managed node group ([#3166](#3166)) ([6974a5e](6974a5e))
@antonbabenko
Copy link
Member

This PR is included in version 20.26.0 🎉

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants