forked from terraform-aws-modules/terraform-aws-eks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Drop random pets from Managed Node Groups (terraform-aws-module…
…s#1372) BREAKING CHANGES: We now decided to remove `random_pet` resources in Managed Node Groups (MNG). Those were used to recreate MNG if something change and also simulate the newly added argument `node_group_name_prefix`. But they were causing a lot of troubles. To upgrade the module without recreating your MNG, you will need to explicitly reuse their previous name and set them in your MNG `name` argument. Please see [upgrade docs](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/upgrades.md#upgrade-module-to-v1700-for-managed-node-groups) for more details.
- Loading branch information
1 parent
3958d94
commit d9cca7d
Showing
14 changed files
with
105 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# How to handle the terraform-aws-eks module upgrade | ||
|
||
## Upgrade module to v17.0.0 for Managed Node Groups | ||
|
||
In this release, we now decided to remove random_pet resources in Managed Node Groups (MNG). Those were used to recreate MNG if something changed. But they were causing a lot of issues. To upgrade the module without recreating your MNG, you will need to explicitly reuse their previous name and set them in your MNG `name` argument. | ||
|
||
1. Run `terraform apply` with the module version v16.2.0 | ||
2. Get your worker group names | ||
```shell | ||
~ terraform state show 'module.eks.module.node_groups.aws_eks_node_group.workers["example"]' | grep node_group_name | ||
node_group_name = "test-eks-mwIwsvui-example-sincere-squid" | ||
``` | ||
3. Upgrade your module and configure your node groups to use existing names | ||
```hcl | ||
module "eks" { | ||
source = "terraform-aws-modules/eks/aws" | ||
version = "17.0.0" | ||
cluster_name = "test-eks-mwIwsvui" | ||
cluster_version = "1.20" | ||
# ... | ||
node_groups = { | ||
example = { | ||
name = "test-eks-mwIwsvui-example-sincere-squid" | ||
# ... | ||
} | ||
} | ||
# ... | ||
} | ||
``` | ||
4. Run `terraform plan`, you shoud see that only `random_pets` will be destroyed | ||
|
||
```shell | ||
Terraform will perform the following actions: | ||
|
||
# module.eks.module.node_groups.random_pet.node_groups["example"] will be destroyed | ||
- resource "random_pet" "node_groups" { | ||
- id = "sincere-squid" -> null | ||
- keepers = { | ||
- "ami_type" = "AL2_x86_64" | ||
- "capacity_type" = "SPOT" | ||
- "disk_size" = "50" | ||
- "iam_role_arn" = "arn:aws:iam::123456789123:role/test-eks-mwIwsvui20210527220853611600000009" | ||
- "instance_types" = "t3.large" | ||
- "key_name" = "" | ||
- "node_group_name" = "test-eks-mwIwsvui-example" | ||
- "source_security_group_ids" = "" | ||
- "subnet_ids" = "subnet-xxxxxxxxxxxx|subnet-xxxxxxxxxxxx|subnet-xxxxxxxxxxxx" | ||
} -> null | ||
- length = 2 -> null | ||
- separator = "-" -> null | ||
} | ||
|
||
Plan: 0 to add, 0 to change, 1 to destroy. | ||
``` | ||
5. If everything sounds good to you, run `terraform apply` | ||
|
||
After the first apply, we recommand you to create a new node group and let the module use the `node_group_name_prefix` (by removing the `name` argument) to generate names and collision during node groups re-creation if needed, because the lifce cycle is `create_before_destroy = true`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ terraform { | |
required_version = ">= 0.13.1" | ||
|
||
required_providers { | ||
aws = ">= 3.22.0" | ||
aws = ">= 3.40.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters