Skip to content

Commit 416515a

Browse files
authored
feat!: Upgrade min AWS provider and Terraform versions to 6.0 and 1.5.7 respectively (#3412)
* feat!: Upgrade min AWS provider and Terraform versions to `6.0` and `1.5.7` respectively * fix: Remove deprecated arguments in AWS v6.0 provider, upgrade Helm provider to v3.0, bump VPC module to v6.0 * fix: Remove `aws-auth` sub-module * fix: Remove `platform` and `cluster_service_ipv4_cidr` variables from `user-data` sub-module * fix: Resolve all marked `todos` that have been accumulated * fix: Set default `http_put_response_hop_limit` to `1` * fix: Remove IRSA support from Karpenter sub-module * fix: Avoid making GET requests from data sources unless absolutely necessary * feat: Add variable optional attribute definitions * feat: Bump KMS key module version to latest, add remaining variable attribute definitions * fix: Remove `cluster_` prefix from variable names to better match the underlying API * fix: Move all EFA logic to the nodegroup itself * fix: Remove arguments that do not make sense in EKS * fix: Updates from plan validation * fix: Remove more self-managed node group attributes that are commonly not used in EKS clusters * fix: Remove data plane compute `*_defaults` variables that do not work with variable optional attributes * fix: Ignore changes to `bootstrap_self_managed_addons` to aid in upgrade * feat: Add support for `region` argument on relevant resources * feat: Initial pass on upgrade guide * fix: Updates from testing and validating EKS managed node group * fix: Updates from testing and validating self-managed node group * docs: Ensure addon ussage documented is aligned * feat: Switch to dualstack OIDC issuer URL * feat: Allow sourcing over overriding the Karpenter assume role policy * fix: Use `Bool` instead of `StringEquals` for DenyHTTP queue policy * fix: Correct use of `nullable` and default value propagation
1 parent 8a0efdb commit 416515a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4136
-3364
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.99.4
3+
rev: v1.99.5
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs

README.md

Lines changed: 145 additions & 151 deletions
Large diffs are not rendered by default.

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
- [Upgrade to v18.x](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-18.0.md)
1212
- [Upgrade to v19.x](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-19.0.md)
1313
- [Upgrade to v20.x](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-20.0.md)
14+
- [Upgrade to v21.x](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-21.0.md)

docs/UPGRADE-21.0.md

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
# Upgrade from v20.x to v21.x
2+
3+
If you have any questions regarding this upgrade process, please consult the [`examples`](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/examples) directory:
4+
If you find a bug, please open an issue with supporting configuration to reproduce.
5+
6+
## List of backwards incompatible changes
7+
8+
- Terraform `v1.5.7` is now minimum supported version
9+
- AWS provider `v6.0.0` is now minimum supported version
10+
- TLS provider `v4.0.0` is now minimum supported version
11+
- The `aws-auth` sub-module has been removed. Users who wish to utilize its functionality can continue to do so by specifying a `v20.x` version, or `~> v20.0` version constraint in their module source.
12+
- `bootstrap_self_managed_addons` is now hardcoded to `false`. This is a legacy setting and instead users should utilize the EKS addons API, which is what this module does by default. In conjunction with this change, the `bootstrap_self_managed_addons` is now ignored by the module to aid in upgrading without disruption (otherwise it would require cluster re-creation).
13+
- When enabling `enable_efa_support` or creating placement groups within a node group, users must now specify the correct `subnet_ids`; the module no longer tries to automatically select a suitable subnet.
14+
- EKS managed node group:
15+
- IMDS now default to a hop limit of 1 (previously was 2)
16+
- `ami_type` now defaults to `AL2023_x86_64_STANDARD`
17+
- `enable_monitoring` is now set to `false` by default
18+
- `enable_efa_only` is now set to `true` by default
19+
- `use_latest_ami_release_version` is now set to `true` by default
20+
- Support for autoscaling group schedules has been removed
21+
- Self-managed node group:
22+
- IMDS now default to a hop limit of 1 (previously was 2)
23+
- `ami_type` now defaults to `AL2023_x86_64_STANDARD`
24+
- `enable_monitoring` is now set to `false` by default
25+
- `enable_efa_only` is now set to `true` by default
26+
- Support for autoscaling group schedules has been removed
27+
- Karpenter:
28+
- Native support for IAM roles for service accounts (IRSA) has been removed; EKS Pod Identity is now enabled by default
29+
- Karpenter controller policy for prior to Karpenter `v1` have been removed (i.e. `v0.33`); the `v1` policy is now used by default
30+
- `create_pod_identity_association` is now set to `true` by default
31+
- `addons.resolve_conflicts_on_create` is now set to `"NONE"` by default (was `"OVERWRITE"`).
32+
- `addons.most_recent` is now set to `true` by default (was `false`).
33+
- `cluster_identity_providers.issuer_url` is now required to be set by users; the prior incorrect default has been removed. See https://github.com/terraform-aws-modules/terraform-aws-eks/pull/3055 and https://github.com/kubernetes/kubernetes/pull/123561 for more details.
34+
- The OIDC issuer URL for IAM roles for service accounts (IRSA) has been changed to use the new dual stack`oidc-eks` endpoint instead of `oidc.eks`. This is to align with https://github.com/aws/containers-roadmap/issues/2038#issuecomment-2278450601
35+
36+
## Additional changes
37+
38+
### Added
39+
40+
- Support for `region` parameter to specify the AWS region for the resources created if different from the provider region.
41+
- Both the EKS managed and self-managed node groups now support creating their own security groups (again). This is primarily motivated by the changes for EFA support; previously users would need to specify `enable_efa_support` both at the cluster level (to add the appropriate security group rules to the shared node security group) as well as the node group level. However, its not always desirable to have these rules across ALL node groups when they are really only required on the node group where EFA is utilized. And similarly for other use cases, users can create custom rules for a specific node group instead of apply across ALL node groups.
42+
43+
### Modified
44+
45+
- Variable definitions now contain detailed `object` types in place of the previously used any type.
46+
- The embedded KMS key module definition has been updated to `v4.0` to support the same version requirements as well as the new `region` argument.
47+
48+
### Variable and output changes
49+
50+
1. Removed variables:
51+
52+
- `enable_efa_support` - users only need to set this within the node group configuration, as the module no longer manages EFA support at the cluster level.
53+
- `enable_security_groups_for_pods` - users can instead attach the `arn:aws:iam::aws:policy/AmazonEKSVPCResourceController` policy via `iam_role_additional_policies` if using security groups for pods.
54+
- `eks-managed-node-group` sub-module
55+
- `cluster_service_ipv4_cidr` - users should use `cluster_service_cidr` instead (for either IPv4 or IPv6).
56+
- `elastic_gpu_specifications`
57+
- `elastic_inference_accelerator`
58+
- `platform` - this is superseded by `ami_type`
59+
- `placement_group_strategy` - set to `cluster` by the module
60+
- `placement_group_az` - users will need to specify the correct subnet in `subnet_ids`
61+
- `create_schedule`
62+
- `schedules`
63+
- `self-managed-node-group` sub-module
64+
- `elastic_gpu_specifications`
65+
- `elastic_inference_accelerator`
66+
- `platform` - this is superseded by `ami_type`
67+
- `create_schedule`
68+
- `schedules`
69+
- `placement_group_az` - users will need to specify the correct subnet in `subnet_ids`
70+
- `hibernation_options` - not valid in EKS
71+
- `min_elb_capacity` - not valid in EKS
72+
- `wait_for_elb_capacity` - not valid in EKS
73+
- `wait_for_capacity_timeout` - not valid in EKS
74+
- `default_cooldown` - not valid in EKS
75+
- `target_group_arns` - not valid in EKS
76+
- `service_linked_role_arn` - not valid in EKS
77+
- `warm_pool` - not valid in EKS
78+
- `fargate-profile` sub-module
79+
- None
80+
- `karpenter` sub-module
81+
- `enable_v1_permissions` - v1 permissions are now the default
82+
- `enable_irsa`
83+
- `irsa_oidc_provider_arn`
84+
- `irsa_namespace_service_accounts`
85+
- `irsa_assume_role_condition_test`
86+
87+
2. Renamed variables:
88+
89+
- Variables prefixed with `cluster_*` have been stripped of the prefix to better match the underlying API:
90+
- `cluster_name` -> `name`
91+
- `cluster_version` -> `kubernetes_version`
92+
- `cluster_enabled_log_types` -> `enabled_log_types`
93+
- `cluster_force_update_version` -> `force_update_version`
94+
- `cluster_compute_config` -> `compute_config`
95+
- `cluster_upgrade_policy` -> `upgrade_policy`
96+
- `cluster_remote_network_config` -> `remote_network_config`
97+
- `cluster_zonal_shift_config` -> `zonal_shift_config`
98+
- `cluster_additional_security_group_ids` -> `additional_security_group_ids`
99+
- `cluster_endpoint_private_access` -> `endpoint_private_access`
100+
- `cluster_endpoint_public_access` -> `endpoint_public_access`
101+
- `cluster_endpoint_public_access_cidrs` -> `endpoint_public_access_cidrs`
102+
- `cluster_ip_family` -> `ip_family`
103+
- `cluster_service_ipv4_cidr` -> `service_ipv4_cidr`
104+
- `cluster_service_ipv6_cidr` -> `service_ipv6_cidr`
105+
- `cluster_encryption_config` -> `encryption_config`
106+
- `create_cluster_primary_security_group_tags` -> `create_primary_security_group_tags`
107+
- `cluster_timeouts` -> `timeouts`
108+
- `create_cluster_security_group` -> `create_security_group`
109+
- `cluster_security_group_id` -> `security_group_id`
110+
- `cluster_security_group_name` -> `security_group_name`
111+
- `cluster_security_group_use_name_prefix` -> `security_group_use_name_prefix`
112+
- `cluster_security_group_description` -> `security_group_description`
113+
- `cluster_security_group_additional_rules` -> `security_group_additional_rules`
114+
- `cluster_security_group_tags` -> `security_group_tags`
115+
- `cluster_encryption_policy_use_name_prefix` -> `encryption_policy_use_name_prefix`
116+
- `cluster_encryption_policy_name` -> `encryption_policy_name`
117+
- `cluster_encryption_policy_description` -> `encryption_policy_description`
118+
- `cluster_encryption_policy_path` -> `encryption_policy_path`
119+
- `cluster_encryption_policy_tags` -> `encryption_policy_tags`
120+
- `cluster_addons` -> `addons`
121+
- `cluster_addons_timeouts` -> `addons_timeouts`
122+
- `cluster_identity_providers` -> `identity_providers`
123+
- `eks-managed-node-group` sub-module
124+
- `cluster_version` -> `kubernetes_version`
125+
- `self-managed-node-group` sub-module
126+
- `cluster_version` -> `kubernetes_version`
127+
- `delete_timeout` -> `timeouts`
128+
- `fargate-profile` sub-module
129+
- None
130+
- `karpenter` sub-module
131+
- None
132+
133+
3. Added variables:
134+
135+
- `region`
136+
- `eks-managed-node-group` sub-module
137+
- `region`
138+
- `partition` - added to reduce number of `GET` requests from data sources when possible
139+
- `account_id` - added to reduce number of `GET` requests from data sources when possible
140+
- `create_security_group`
141+
- `security_group_name`
142+
- `security_group_use_name_prefix`
143+
- `security_group_description`
144+
- `security_group_ingress_rules`
145+
- `security_group_egress_rules`
146+
- `security_group_tags`
147+
- `self-managed-node-group` sub-module
148+
- `region`
149+
- `partition` - added to reduce number of `GET` requests from data sources when possible
150+
- `account_id` - added to reduce number of `GET` requests from data sources when possible
151+
- `create_security_group`
152+
- `security_group_name`
153+
- `security_group_use_name_prefix`
154+
- `security_group_description`
155+
- `security_group_ingress_rules`
156+
- `security_group_egress_rules`
157+
- `security_group_tags`
158+
- `fargate-profile` sub-module
159+
- `region`
160+
- `partition` - added to reduce number of `GET` requests from data sources when possible
161+
- `account_id` - added to reduce number of `GET` requests from data sources when possible
162+
- `karpenter` sub-module
163+
- `region`
164+
165+
4. Removed outputs:
166+
167+
- `eks-managed-node-group` sub-module
168+
- `platform` - this is superseded by `ami_type`
169+
- `autoscaling_group_schedule_arns`
170+
- `self-managed-node-group` sub-module
171+
- `platform` - this is superseded by `ami_type`
172+
- `autoscaling_group_schedule_arns`
173+
- `fargate-profile` sub-module
174+
- None
175+
- `karpenter` sub-module
176+
- None
177+
178+
5. Renamed outputs:
179+
180+
- `eks-managed-node-group` sub-module
181+
- None
182+
- `self-managed-node-group` sub-module
183+
- None
184+
- `fargate-profile` sub-module
185+
- None
186+
- `karpenter` sub-module
187+
- None
188+
189+
6. Added outputs:
190+
191+
- `eks-managed-node-group` sub-module
192+
- `security_group_arn`
193+
- `security_group_id`
194+
- `self-managed-node-group` sub-module
195+
- `security_group_arn`
196+
- `security_group_id`
197+
- `fargate-profile` sub-module
198+
- None
199+
- `karpenter` sub-module
200+
- None
201+
202+
## Upgrade Migrations
203+
204+
### Before 20.x Example
205+
206+
```hcl
207+
module "eks" {
208+
source = "terraform-aws-modules/eks/aws"
209+
version = "~> 20.0"
210+
211+
# Truncated for brevity ...
212+
# Renamed variables are not shown here, please refer to the full list above.
213+
214+
enable_efa_support = true
215+
216+
eks_managed_node_group_defaults = {
217+
iam_role_additional_policies = {
218+
AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
219+
}
220+
}
221+
222+
eks_managed_node_groups = {
223+
efa = {
224+
ami_type = "AL2023_x86_64_NVIDIA"
225+
instance_types = ["p5e.48xlarge"]
226+
227+
enable_efa_support = true
228+
enable_efa_only = true
229+
}
230+
}
231+
232+
self_managed_node_groups = {
233+
example = {
234+
use_mixed_instances_policy = true
235+
mixed_instances_policy = {
236+
instances_distribution = {
237+
on_demand_base_capacity = 0
238+
on_demand_percentage_above_base_capacity = 0
239+
on_demand_allocation_strategy = "lowest-price"
240+
spot_allocation_strategy = "price-capacity-optimized"
241+
}
242+
243+
# ASG configuration
244+
override = [
245+
{
246+
instance_requirements = {
247+
cpu_manufacturers = ["intel"]
248+
instance_generations = ["current", "previous"]
249+
spot_max_price_percentage_over_lowest_price = 100
250+
251+
vcpu_count = {
252+
min = 1
253+
}
254+
255+
allowed_instance_types = ["t*", "m*"]
256+
}
257+
}
258+
]
259+
}
260+
}
261+
}
262+
}
263+
```
264+
265+
### After 21.x Example
266+
267+
```hcl
268+
module "eks" {
269+
source = "terraform-aws-modules/eks/aws"
270+
version = "~> 21.0"
271+
272+
# Truncated for brevity ...
273+
# Renamed variables are not shown here, please refer to the full list above.
274+
275+
eks_managed_node_groups = {
276+
efa = {
277+
ami_type = "AL2023_x86_64_NVIDIA"
278+
instance_types = ["p5e.48xlarge"]
279+
280+
iam_role_additional_policies = {
281+
AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
282+
}
283+
284+
enable_efa_support = true
285+
286+
subnet_ids = element(module.vpc.private_subnets, 0)
287+
}
288+
}
289+
290+
self_managed_node_groups = {
291+
example = {
292+
use_mixed_instances_policy = true
293+
mixed_instances_policy = {
294+
instances_distribution = {
295+
on_demand_base_capacity = 0
296+
on_demand_percentage_above_base_capacity = 0
297+
on_demand_allocation_strategy = "lowest-price"
298+
spot_allocation_strategy = "price-capacity-optimized"
299+
}
300+
301+
# ASG configuration
302+
# Need to wrap in `launch_template` now
303+
launch_template = {
304+
override = [
305+
{
306+
instance_requirements = {
307+
cpu_manufacturers = ["intel"]
308+
instance_generations = ["current", "previous"]
309+
spot_max_price_percentage_over_lowest_price = 100
310+
311+
vcpu_count = {
312+
min = 1
313+
}
314+
315+
allowed_instance_types = ["t*", "m*"]
316+
}
317+
}
318+
]
319+
}
320+
}
321+
}
322+
}
323+
}
324+
```
325+
326+
### State Changes
327+
328+
No state changes required.

0 commit comments

Comments
 (0)