Open chrisghill opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Thanks for opening this ticket!
I tried to find a solution before this implemented, and always ended to this ticket. Just posted a workaround solution before this is ready to help people save some time. 😃
Step 1
Step 2
Step 3
Once you increased "Desired size" and "Minimum size" here, then you can update your Terraform code min_size
and desired_size
to match this latest size. And it should show "No changes. Your infrastructure matches the configuration."
@hongbo-miao https://github.com/bryantbiggs/eks-desired-size-hack
Description
The
desired_size
argument in thescaling_config
block of theaws_eks_node_group
resource is currently a required argument and I'd like to make it optional. I'm assuming the reason it is currently required is the aws-sdk-go states that "When creating a node group, you must specify all or none of the properties.". However, on updates you can specify "any or none".This field being required creates problems when there is a cluster-autoscaler installed since the field may change outside of terraform. The official docs even suggest that users add the
desired_size
field to anignore_changes
block to prevent a cluster-autoscaler from resetting the value on applies. This creates problems when users try to change themin_size
ormax_size
arguments sincemin_size
can't be greater thandesired_size
andmax_size
can't be less thandesired_size
. Take for example, this config:If I later tried to update the scaling config to:
This would cause an API error since the
desired_size
field has changes ignored and thus will still be set at1
while themin_size
increased to 2. This behavior is reported many times in the official EKS module (see references).I'm proposing that we make the
desired_size
field optional. The API only requires the field on creation (not updates), and we can just default thedesired_size
tomin_size
during creation if its omitted (and make this behavior clear in the documentation). This would allow users to simply omit the field if an autoscaler is installed.Happy to implement the fix if approved.
Affected Resource(s) and/or Data Source(s)
aws_eks_node_group
Potential Terraform Configuration
References
Would you like to implement a fix?
Yes