Skip to content

Commit 9b473e4

Browse files
bryantbiggsspr-mweber3
authored andcommitted
feat!: Add support for Outposts, remove node security group, add support for addon preserve and most_recent configurations (terraform-aws-modules#2250)
Co-authored-by: Anton Babenko <anton@antonbabenko.com> Resolves undefined
1 parent af4c204 commit 9b473e4

Some content is hidden

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

66 files changed

+2742
-1652
lines changed

.github/images/security_groups.svg

+1-1
Loading

.pre-commit-config.yaml

+2-2
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.76.0
3+
rev: v1.77.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate
@@ -23,7 +23,7 @@ repos:
2323
- '--args=--only=terraform_standard_module_structure'
2424
- '--args=--only=terraform_workspace_remote'
2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.3.0
26+
rev: v4.4.0
2727
hooks:
2828
- id: check-merge-conflict
2929
- id: end-of-file-fixer

README.md

+55-38
Large diffs are not rendered by default.

docs/UPGRADE-19.0.md

+466
Large diffs are not rendered by default.

docs/compute_resources.md

+23-25
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ Refer to the [EKS Managed Node Group documentation](https://docs.aws.amazon.com/
1818
```hcl
1919
eks_managed_node_groups = {
2020
default = {
21-
create_launch_template = false
22-
launch_template_name = ""
21+
use_custom_launch_template = false
2322
}
2423
}
2524
```
@@ -29,8 +28,7 @@ Refer to the [EKS Managed Node Group documentation](https://docs.aws.amazon.com/
2928
```hcl
3029
eks_managed_node_groups = {
3130
bottlerocket_default = {
32-
create_launch_template = false
33-
launch_template_name = ""
31+
use_custom_launch_template = false
3432
3533
ami_type = "BOTTLEROCKET_x86_64"
3634
platform = "bottlerocket"
@@ -45,15 +43,15 @@ Refer to the [EKS Managed Node Group documentation](https://docs.aws.amazon.com/
4543
prepend_userdata = {
4644
# See issue https://github.com/awslabs/amazon-eks-ami/issues/844
4745
pre_bootstrap_user_data = <<-EOT
48-
#!/bin/bash
49-
set -ex
50-
cat <<-EOF > /etc/profile.d/bootstrap.sh
51-
export CONTAINER_RUNTIME="containerd"
52-
export USE_MAX_PODS=false
53-
export KUBELET_EXTRA_ARGS="--max-pods=110"
54-
EOF
55-
# Source extra environment variables in bootstrap script
56-
sed -i '/^set -o errexit/a\\nsource /etc/profile.d/bootstrap.sh' /etc/eks/bootstrap.sh
46+
#!/bin/bash
47+
set -ex
48+
cat <<-EOF > /etc/profile.d/bootstrap.sh
49+
export CONTAINER_RUNTIME="containerd"
50+
export USE_MAX_PODS=false
51+
export KUBELET_EXTRA_ARGS="--max-pods=110"
52+
EOF
53+
# Source extra environment variables in bootstrap script
54+
sed -i '/^set -o errexit/a\\nsource /etc/profile.d/bootstrap.sh' /etc/eks/bootstrap.sh
5755
EOT
5856
}
5957
}
@@ -68,9 +66,9 @@ Refer to the [EKS Managed Node Group documentation](https://docs.aws.amazon.com/
6866
platform = "bottlerocket"
6967
7068
bootstrap_extra_args = <<-EOT
71-
# extra args added
72-
[settings.kernel]
73-
lockdown = "integrity"
69+
# extra args added
70+
[settings.kernel]
71+
lockdown = "integrity"
7472
EOT
7573
}
7674
}
@@ -116,17 +114,17 @@ Refer to the [EKS Managed Node Group documentation](https://docs.aws.amazon.com/
116114
enable_bootstrap_user_data = true
117115
# this will get added to the template
118116
bootstrap_extra_args = <<-EOT
119-
# extra args added
120-
[settings.kernel]
121-
lockdown = "integrity"
117+
# extra args added
118+
[settings.kernel]
119+
lockdown = "integrity"
122120
123-
[settings.kubernetes.node-labels]
124-
"label1" = "foo"
125-
"label2" = "bar"
121+
[settings.kubernetes.node-labels]
122+
"label1" = "foo"
123+
"label2" = "bar"
126124
127-
[settings.kubernetes.node-taints]
128-
"dedicated" = "experimental:PreferNoSchedule"
129-
"special" = "true:NoSchedule"
125+
[settings.kubernetes.node-taints]
126+
"dedicated" = "experimental:PreferNoSchedule"
127+
"special" = "true:NoSchedule"
130128
EOT
131129
}
132130
}

docs/faq.md

-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Frequently Asked Questions
22

33
- [I received an error: `expect exactly one securityGroup tagged with kubernetes.io/cluster/<NAME> ...`](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/faq.md#i-received-an-error-expect-exactly-one-securitygroup-tagged-with-kubernetesioclustername-)
4-
- [I received an error: `Error: Invalid for_each argument ...`](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/faq.md#i-received-an-error-error-invalid-for_each-argument-)
54
- [Why are nodes not being registered?](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/faq.md#why-are-nodes-not-being-registered)
65
- [Why are there no changes when a node group's `desired_size` is modified?](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/faq.md#why-are-there-no-changes-when-a-node-groups-desired_size-is-modified)
76
- [How can I deploy Windows based nodes?](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/faq.md#how-can-i-deploy-windows-based-nodes)
@@ -48,41 +47,6 @@ By default, EKS creates a cluster primary security group that is created outside
4847

4948
In theory, if you are attaching the cluster primary security group, you shouldn't need to use the shared node security group created by the module. However, this is left up to users to decide for their requirements and use case.
5049

51-
### I received an error: `Error: Invalid for_each argument ...`
52-
53-
Users may encounter an error such as `Error: Invalid for_each argument - The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply ...`
54-
55-
This error is due to an upstream issue with [Terraform core](https://github.com/hashicorp/terraform/issues/4149). There are two potential options you can take to help mitigate this issue:
56-
57-
1. Create the dependent resources before the cluster => `terraform apply -target <your policy or your security group>` and then `terraform apply` for the cluster (or other similar means to just ensure the referenced resources exist before creating the cluster)
58-
59-
- Note: this is the route users will have to take for adding additional security groups to nodes since there isn't a separate "security group attachment" resource
60-
61-
2. For additional IAM policies, users can attach the policies outside of the cluster definition as demonstrated below
62-
63-
```hcl
64-
resource "aws_iam_role_policy_attachment" "additional" {
65-
for_each = module.eks.eks_managed_node_groups
66-
# you could also do the following or any combination:
67-
# for_each = merge(
68-
# module.eks.eks_managed_node_groups,
69-
# module.eks.self_managed_node_group,
70-
# module.eks.fargate_profile,
71-
# )
72-
73-
# This policy does not have to exist at the time of cluster creation. Terraform can
74-
# deduce the proper order of its creation to avoid errors during creation
75-
policy_arn = aws_iam_policy.node_additional.arn
76-
role = each.value.iam_role_name
77-
}
78-
```
79-
80-
TL;DR - Terraform resource passed into the modules map definition _must_ be known before you can apply the EKS module. The variables this potentially affects are:
81-
82-
- `cluster_security_group_additional_rules` (i.e. - referencing an external security group resource in a rule)
83-
- `node_security_group_additional_rules` (i.e. - referencing an external security group resource in a rule)
84-
- `iam_role_additional_policies` (i.e. - referencing an external policy resource)
85-
8650
### Why are nodes not being registered?
8751

8852
Nodes not being able to register with the EKS control plane is generally due to networking mis-configurations.

docs/network_connectivity.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ Please refer to the [AWS documentation](https://docs.aws.amazon.com/eks/latest/u
2020
- Lastly, users are able to opt in to attaching the primary security group automatically created by the EKS service by setting `attach_cluster_primary_security_group` = `true` from the root module for the respective node group (or set it within the node group defaults). This security group is not managed by the module; it is created by the EKS service. It permits all traffic within the domain of the security group as well as all egress traffic to the internet.
2121

2222
- Node Group Security Group(s)
23-
- Each node group (EKS Managed Node Group and Self Managed Node Group) by default creates its own security group. By default, this security group does not contain any additional security group rules. It is merely an "empty container" that offers users the ability to opt into any addition inbound our outbound rules as necessary
24-
- Users also have the option to supply their own, and/or additional, externally created security group(s) to the node group as well via the `vpc_security_group_ids` variable
23+
- Users have the option to assign their own externally created security group(s) to the node group via the `vpc_security_group_ids` variable
2524

2625
See the example snippet below which adds additional security group rules to the cluster security group as well as the shared node security group (for node-to-node access). Users can use this extensibility to open up network access as they see fit using the security groups provided by the module:
2726

docs/user_data.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ Since the EKS Managed Node Group service provides the necessary bootstrap user d
5555
```hcl
5656
# See issue https://github.com/awslabs/amazon-eks-ami/issues/844
5757
pre_bootstrap_user_data = <<-EOT
58-
#!/bin/bash
59-
set -ex
60-
cat <<-EOF > /etc/profile.d/bootstrap.sh
61-
export CONTAINER_RUNTIME="containerd"
62-
export USE_MAX_PODS=false
63-
export KUBELET_EXTRA_ARGS="--max-pods=110"
64-
EOF
65-
# Source extra environment variables in bootstrap script
66-
sed -i '/^set -o errexit/a\\nsource /etc/profile.d/bootstrap.sh' /etc/eks/bootstrap.sh
58+
#!/bin/bash
59+
set -ex
60+
cat <<-EOF > /etc/profile.d/bootstrap.sh
61+
export CONTAINER_RUNTIME="containerd"
62+
export USE_MAX_PODS=false
63+
export KUBELET_EXTRA_ARGS="--max-pods=110"
64+
EOF
65+
# Source extra environment variables in bootstrap script
66+
sed -i '/^set -o errexit/a\\nsource /etc/profile.d/bootstrap.sh' /etc/eks/bootstrap.sh
6767
EOT
6868
```
6969

examples/complete/README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ Note that this example may create resources which cost money. Run `terraform des
3333

3434
| Name | Version |
3535
|------|---------|
36-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
37-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72 |
36+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
37+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.45 |
3838
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.10 |
3939

4040
## Providers
4141

4242
| Name | Version |
4343
|------|---------|
44-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.72 |
44+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.45 |
4545

4646
## Modules
4747

@@ -61,7 +61,9 @@ Note that this example may create resources which cost money. Run `terraform des
6161

6262
| Name | Type |
6363
|------|------|
64+
| [aws_iam_policy.additional](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
6465
| [aws_security_group.additional](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
66+
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
6567

6668
## Inputs
6769

@@ -81,9 +83,9 @@ No inputs.
8183
| <a name="output_cluster_iam_role_arn"></a> [cluster\_iam\_role\_arn](#output\_cluster\_iam\_role\_arn) | IAM role ARN of the EKS cluster |
8284
| <a name="output_cluster_iam_role_name"></a> [cluster\_iam\_role\_name](#output\_cluster\_iam\_role\_name) | IAM role name of the EKS cluster |
8385
| <a name="output_cluster_iam_role_unique_id"></a> [cluster\_iam\_role\_unique\_id](#output\_cluster\_iam\_role\_unique\_id) | Stable and unique string identifying the IAM role |
84-
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The id of the EKS cluster. Will block on cluster creation until the cluster is really ready |
86+
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | The ID of the EKS cluster. Note: currently a value is returned only for local EKS clusters created on Outposts |
8587
| <a name="output_cluster_identity_providers"></a> [cluster\_identity\_providers](#output\_cluster\_identity\_providers) | Map of attribute maps for all EKS identity providers enabled |
86-
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster. Will block on cluster creation until the cluster is really ready |
88+
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | The name of the EKS cluster |
8789
| <a name="output_cluster_oidc_issuer_url"></a> [cluster\_oidc\_issuer\_url](#output\_cluster\_oidc\_issuer\_url) | The URL on the EKS cluster for the OpenID Connect identity provider |
8890
| <a name="output_cluster_platform_version"></a> [cluster\_platform\_version](#output\_cluster\_platform\_version) | Platform version for the cluster |
8991
| <a name="output_cluster_security_group_arn"></a> [cluster\_security\_group\_arn](#output\_cluster\_security\_group\_arn) | Amazon Resource Name (ARN) of the cluster security group |

0 commit comments

Comments
 (0)