terraform-aws-eks
terraform-aws-eks copied to clipboard
Upgrading from v17 to v18 wants to destroy my AutoScalingGroups
Description
While trying to upgrade my repo to v18, I noticed that all my ASGs are going to be recreated, destroying all my worker nodes. I'm using "Worker groups", now called "self_managed_nodes"
Seems like the aws_autoscaling_group
resource used to be called workers
and now is called this
. This will recreate all of my autoscaling groups. Am I wrong?
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/e90c877a741ab3cc4215376a70f7bcc360b6a3d2/workers.tf#L3
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/modules/self-managed-node-group/main.tf#L265
- [x] β I have searched the open/closed issues and my issue is not listed.
Versions
-
Module version [Required]: v18.23.0
-
Terraform version:
Terraform v0.14.11
-
Provider version(s):
+ provider registry.terraform.io/hashicorp/aws v3.75.2
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.11.0
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.2.0
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/hashicorp/tls v3.4.0
+ provider registry.terraform.io/terraform-aws-modules/http v2.4.1
Please see https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-18.0.md
Yes, I've seen the doc and followed it, that doesn't change the fact that now the resource name for the aws_autoscaling_group
has a different name and it forces recreation:
# module.eks-cluster-use1-1.aws_autoscaling_group.workers[10] will be destroyed
- resource "aws_autoscaling_group" "workers" {
# module.eks-cluster-use1-1.module.self_managed_node_group["default"].aws_autoscaling_group.this[0] will be created
+ resource "aws_autoscaling_group" "this" {
Correct - the resource names have changed and if you would like to retain the existing data plane resources you'll have to do some terraform state mv ...
and capture the current full names of resources like https://github.com/clowdhaus/eks-v17-v18-migrate/blob/main/v18.tf#L84-L90
Dang, that's a lot of work for me, we have a ton of clusters which 10 ASGs each, plus some dependencies. I know that y'all are doing this for free, and we shouldn't complain, but why were the resource names changed? By doing that y'all forcing everyone to mess up with the state ... :(
In v18 nearly everything changed - it had to, the module was untenable and reached a critical point in terms of maintainability and being able to support requests. It was a breaking change so I made as many changes as possible to put the project back on a path that we could support for many more years to come. its just the unfortunate nature with Terraform that breaking changes can be very disruptive/destructive since there are no abstractions
@bryantbiggs it would help with migration if name prefix could be specified with no -
suffix being added by the module https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/modules/self-managed-node-group/main.tf#L269
Would you mind adding name_prefix
variable, default to empty for backward compatibility, if not empty use it instead of name
+ -
, so exact name prefix can be specified and used, as alternative to collecting all names of all ASGs of all clusters and hardcoding them which https://github.com/clowdhaus/eks-v17-v18-migrate/blob/main/v18.tf#L84-L90 suggests? Similarly, add_trailing_dash_to_name_prefix
boolean could be added, default to true for backward compatibility, to allow turning it off.
For codifying the moves, I've temporarily forked the terraform-aws-eks module, added moved blocks to moved.tf, and after one round of apply can switch away from the fork.
The suffix logic is a problem though. I can codify in the fork my prefix to be same as before (configuring name + use_prefix, and removing that trailing -
eks module is adding), but to be able to get away from the fork, exact name_prefix
support upstream is needed.
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.