Skip to content

Commit 53b54d9

Browse files
committed
feat(eks-official-image): support ubuntu 24.04 eks images
1 parent 7f38473 commit 53b54d9

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

modules/eks-official-image/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This module creates following resources.
77

88
| Name | Version |
99
|------|---------|
10-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.10 |
10+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6 |
1111
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
1212

1313
## Providers
@@ -31,7 +31,7 @@ No modules.
3131
| Name | Description | Type | Default | Required |
3232
|------|-------------|------|---------|:--------:|
3333
| <a name="input_kubernetes_version"></a> [kubernetes\_version](#input\_kubernetes\_version) | (Required) Desired Kubernetes version to search the official EKS AMIs for the EKS cluster. | `string` | n/a | yes |
34-
| <a name="input_os"></a> [os](#input\_os) | (Required) A configuration of OS (Operating System) to search EKS official AMIs. `os` block as defined below.<br/> (Required) `name` - A name of the OS (Operating System). Valid values are `amazon-linux`, `ubuntu`, `ubuntu-pro`.<br/> (Required) `release` - A release name of the OS.<br/> `amazon-linux` - Valid values are `2`, `2023`.<br/> `ubuntu` - Valid values are `18.04`, `20.04`, `22.04`, `24.04`.<br/> `ubuntu-pro` - Same with `ubuntu`. | <pre>object({<br/> name = string<br/> release = string<br/> })</pre> | n/a | yes |
34+
| <a name="input_os"></a> [os](#input\_os) | (Required) A configuration of OS (Operating System) to search EKS official AMIs. `os` block as defined below.<br/> (Required) `name` - A name of the OS (Operating System). Valid values are `amazon-linux`, `ubuntu`, `ubuntu-pro`.<br/> (Required) `release` - A release name of the OS.<br/> `amazon-linux` - Valid values are `2`, `2023`.<br/> `ubuntu` - Valid values are `18.04`, `20.04`, `22.04`, `24.04`, `26.04`.<br/> `ubuntu-pro` - Same with `ubuntu`. | <pre>object({<br/> name = string<br/> release = string<br/> })</pre> | n/a | yes |
3535
| <a name="input_arch"></a> [arch](#input\_arch) | (Optional) The type of the CPU architecture. Valid values are `amd64`, `arm64`. Defaults to `amd64`. | `string` | `"amd64"` | no |
3636

3737
## Outputs

modules/eks-official-image/main.tf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ locals {
2323
"ubuntu-pro" = "/aws/service/canonical/ubuntu/eks-pro"
2424
}
2525
}
26+
ubuntu_ebs_volume_type = {
27+
"18.04" = "ebs-gp2"
28+
"bionic" = "ebs-gp2"
29+
"20.04" = "ebs-gp2"
30+
"focal" = "ebs-gp2"
31+
"22.04" = "ebs-gp2"
32+
"jammy" = "ebs-gp2"
33+
"24.04" = "ebs-gp3"
34+
"noble" = "ebs-gp3"
35+
"26.04" = "ebs-gp3"
36+
}
2637
parameter_name = (var.os.name == "amazon-linux"
2738
? join("/", [
2839
"/aws/service/eks/optimized-ami/${var.kubernetes_version}",
@@ -36,7 +47,7 @@ locals {
3647
var.kubernetes_version,
3748
"stable/current",
3849
var.arch,
39-
"hvm/ebs-gp2/ami-id",
50+
"hvm/${local.ubuntu_ebs_volume_type[var.os.name]}/ami-id",
4051
])
4152
: null
4253
)

modules/eks-official-image/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ variable "os" {
1010
(Required) `name` - A name of the OS (Operating System). Valid values are `amazon-linux`, `ubuntu`, `ubuntu-pro`.
1111
(Required) `release` - A release name of the OS.
1212
`amazon-linux` - Valid values are `2`, `2023`.
13-
`ubuntu` - Valid values are `18.04`, `20.04`, `22.04`, `24.04`.
13+
`ubuntu` - Valid values are `18.04`, `20.04`, `22.04`, `24.04`, `26.04`.
1414
`ubuntu-pro` - Same with `ubuntu`.
1515
EOF
1616
type = object({
@@ -26,9 +26,9 @@ variable "os" {
2626
validation {
2727
condition = anytrue([
2828
var.os.name == "amazon-linux" && contains(["2", "2023"], var.os.release),
29-
contains(["ubuntu", "ubuntu-pro"], var.os.name) && contains(["18.04", "20.04", "22.04", "24.04"], var.os.release),
29+
contains(["ubuntu", "ubuntu-pro"], var.os.name) && contains(["18.04", "20.04", "22.04", "24.04", "26.04"], var.os.release),
3030
])
31-
error_message = "Valid values for `os.release` are `2`, `2023` when `os.name` is `amazon-linux`. Valid values for `os.release` are `18.04`, `20.04`, `22.04`, `24.04` when `os.name` is `ubuntu` or `ubuntu-pro`."
31+
error_message = "Valid values for `os.release` are `2`, `2023` when `os.name` is `amazon-linux`. Valid values for `os.release` are `18.04`, `20.04`, `22.04`, `24.04`, `26.04` when `os.name` is `ubuntu` or `ubuntu-pro`."
3232
}
3333
}
3434

0 commit comments

Comments
 (0)