diff --git a/aws/eks-cluster/README.md b/aws/eks-cluster/README.md index d4639b52..c270c949 100644 --- a/aws/eks-cluster/README.md +++ b/aws/eks-cluster/README.md @@ -20,7 +20,7 @@ | Name | Source | Version | |------|--------|---------| -| [managed\_node\_group](#module\_managed\_node\_group) | github.com/mattermost/mattermost-cloud-monitoring.git//aws/eks-managed-node-groups | v1.7.5 | +| [managed\_node\_group](#module\_managed\_node\_group) | github.com/mattermost/mattermost-cloud-monitoring.git//aws/eks-managed-node-groups | v1.8.19 | ## Resources @@ -62,6 +62,7 @@ | [kubernetes_cluster_role_binding.console_access](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role_binding) | resource | | [kubernetes_config_map.aws_auth_configmap](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source | | [aws_eks_cluster_auth.cluster_auth](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster_auth) | data source | | [tls_certificate.cluster-openid-issuer](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/data-sources/certificate) | data source | @@ -69,6 +70,8 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [al2023\_ami\_id](#input\_al2023\_ami\_id) | The AMI ID for AL2023 nodes | `string` | `""` | no | +| [al2023\_arm\_image\_id](#input\_al2023\_arm\_image\_id) | The AMI ID for ARM64 nodes using AL2023 | `string` | `""` | no | | [argocd\_account\_role](#input\_argocd\_account\_role) | n/a | `string` | n/a | yes | | [arm\_desired\_size](#input\_arm\_desired\_size) | The desired number of arm nodes in the node group | `string` | n/a | yes | | [arm\_instance\_type](#input\_arm\_instance\_type) | The instance type used for the arm nodes in the node group | `string` | n/a | yes | @@ -107,6 +110,7 @@ | [spot\_max\_size](#input\_spot\_max\_size) | The maximum number of nodes in the spot node group | `number` | `1` | no | | [spot\_min\_size](#input\_spot\_min\_size) | The minimum number of nodes in the spot node group | `number` | `0` | no | | [teleport\_cidr](#input\_teleport\_cidr) | n/a | `list(string)` | n/a | yes | +| [use\_al2023](#input\_use\_al2023) | Enable AL2023-specific configurations. Defaults to false for AL2. | `bool` | `false` | no | | [vpc\_cni\_addon\_version](#input\_vpc\_cni\_addon\_version) | The version of the EKS VPC CNI addon | `string` | n/a | yes | | [vpc\_id](#input\_vpc\_id) | n/a | `string` | n/a | yes | diff --git a/aws/eks-cluster/master.tf b/aws/eks-cluster/master.tf index 87f74706..9d01e803 100644 --- a/aws/eks-cluster/master.tf +++ b/aws/eks-cluster/master.tf @@ -19,6 +19,10 @@ resource "aws_eks_cluster" "cluster" { ] } +data "aws_eks_cluster" "cluster" { + name = aws_eks_cluster.cluster.name +} + # Get EKS cluster certificate thumbprint data "tls_certificate" "cluster-openid-issuer" { url = aws_eks_cluster.cluster.identity[0].oidc[0].issuer diff --git a/aws/eks-cluster/variables.tf b/aws/eks-cluster/variables.tf index 9d85c4aa..303467b5 100644 --- a/aws/eks-cluster/variables.tf +++ b/aws/eks-cluster/variables.tf @@ -182,3 +182,21 @@ variable "arm_min_size" { type = string description = "The minimum number of arm nodes in the node group" } + +variable "use_al2023" { + description = "Enable AL2023-specific configurations. Defaults to false for AL2." + type = bool + default = false +} + +variable "al2023_ami_id" { + description = "The AMI ID for AL2023 nodes" + type = string + default = "" +} + +variable "al2023_arm_image_id" { + description = "The AMI ID for ARM64 nodes using AL2023" + type = string + default = "" +} diff --git a/aws/eks-cluster/worker_asg.tf b/aws/eks-cluster/worker_asg.tf index 64a43dab..284f297e 100644 --- a/aws/eks-cluster/worker_asg.tf +++ b/aws/eks-cluster/worker_asg.tf @@ -1,10 +1,30 @@ ###########ยป Worker Node AutoScaling Group########### locals { - worker-userdata = < /etc/eks/nodeadm-config.yaml +apiVersion: node.eks.aws/v1alpha1 +kind: NodeConfig +spec: + cluster: + name: ${aws_eks_cluster.cluster.name} + apiServerEndpoint: ${aws_eks_cluster.cluster.endpoint} + certificateAuthority: ${aws_eks_cluster.cluster.certificate_authority[0].data} + cidr: ${local.service_cidr} +EOF + +/usr/local/bin/nodeadm --config /etc/eks/nodeadm-config.yaml +USERDATA + ) : base64encode(<