Skip to content

Commit 3c02688

Browse files
DT-521 use AL2023 (#33)
* update ami node type gp3 * remove ubuntu18 * remove ubuntu18 add al2023
1 parent 03ba3f0 commit 3c02688

File tree

4 files changed

+49
-44
lines changed

4 files changed

+49
-44
lines changed

main.tf

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,6 @@ module "comet_eks" {
9393
eks_airflow_node_count = var.eks_airflow_node_count
9494
}
9595

96-
resource "kubernetes_storage_class" "gp3" {
97-
metadata {
98-
name = "gp3"
99-
annotations = {
100-
"storageclass.kubernetes.io/is-default-class" = "true"
101-
}
102-
}
103-
104-
storage_provisioner = "ebs.csi.aws.com"
105-
106-
parameters = {
107-
type = "gp3"
108-
# Optionally, set iops and throughput:
109-
# iops = "3000"
110-
# throughput = "125"
111-
}
112-
113-
reclaim_policy = "Delete"
114-
volume_binding_mode = "WaitForFirstConsumer"
115-
allow_volume_expansion = true
116-
}
117-
11896
module "comet_elasticache" {
11997
source = "./modules/comet_elasticache"
12098
count = var.enable_elasticache ? 1 : 0

modules/comet_ec2/main.tf

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,33 @@ locals {
66
cidr_anywhere = "0.0.0.0/0"
77
}
88

9-
data "aws_ami" "al2" {
9+
data "aws_ami" "al2023" {
1010
most_recent = true
1111

1212
filter {
1313
name = "name"
14-
values = ["amzn2-ami-hvm-*-x86_64-gp2"]
14+
values = ["al2023-ami-*-x86_64"]
15+
}
16+
17+
filter {
18+
name = "architecture"
19+
values = ["x86_64"]
1520
}
1621

1722
filter {
1823
name = "root-device-type"
1924
values = ["ebs"]
2025
}
2126

22-
owners = ["amazon"]
27+
owners = ["137112412989"] # Amazon official
2328
}
2429

25-
data "aws_ami" "rhel7" {
30+
data "aws_ami" "al2" {
2631
most_recent = true
2732

2833
filter {
2934
name = "name"
30-
values = ["RHEL-7*_HVM-*"]
35+
values = ["amzn2-ami-hvm-*-x86_64-gp2"]
3136
}
3237

3338
filter {
@@ -38,12 +43,12 @@ data "aws_ami" "rhel7" {
3843
owners = ["amazon"]
3944
}
4045

41-
data "aws_ami" "rhel8" {
46+
data "aws_ami" "rhel7" {
4247
most_recent = true
4348

4449
filter {
4550
name = "name"
46-
values = ["RHEL-8*_HVM-*"]
51+
values = ["RHEL-7*_HVM-*"]
4752
}
4853

4954
filter {
@@ -54,12 +59,12 @@ data "aws_ami" "rhel8" {
5459
owners = ["amazon"]
5560
}
5661

57-
data "aws_ami" "rhel9" {
62+
data "aws_ami" "rhel8" {
5863
most_recent = true
5964

6065
filter {
6166
name = "name"
62-
values = ["RHEL-9*_HVM-*"]
67+
values = ["RHEL-8*_HVM-*"]
6368
}
6469

6570
filter {
@@ -70,12 +75,12 @@ data "aws_ami" "rhel9" {
7075
owners = ["amazon"]
7176
}
7277

73-
data "aws_ami" "ubuntu18" {
78+
data "aws_ami" "rhel9" {
7479
most_recent = true
7580

7681
filter {
7782
name = "name"
78-
values = ["ubuntu/images/hvm-ssd/ubuntu-*-18.04-amd64-server-*"]
83+
values = ["RHEL-9*_HVM-*"]
7984
}
8085

8186
filter {
@@ -120,11 +125,11 @@ data "aws_ami" "ubuntu22" {
120125

121126
resource "aws_instance" "comet_ec2" {
122127
ami = var.comet_ec2_ami_id != "" ? var.comet_ec2_ami_id : (
123-
var.comet_ec2_ami_type == "al2" ? data.aws_ami.al2.id : (
124-
var.comet_ec2_ami_type == "rhel7" ? data.aws_ami.rhel7.id : (
125-
var.comet_ec2_ami_type == "rhel8" ? data.aws_ami.rhel8.id : (
126-
var.comet_ec2_ami_type == "rhel9" ? data.aws_ami.rhel9.id : (
127-
var.comet_ec2_ami_type == "ubuntu18" ? data.aws_ami.ubuntu18.id : (
128+
var.comet_ec2_ami_type == "al2023" ? data.aws_ami.al2023.id : (
129+
var.comet_ec2_ami_type == "al2" ? data.aws_ami.al2.id : (
130+
var.comet_ec2_ami_type == "rhel7" ? data.aws_ami.rhel7.id : (
131+
var.comet_ec2_ami_type == "rhel8" ? data.aws_ami.rhel8.id : (
132+
var.comet_ec2_ami_type == "rhel9" ? data.aws_ami.rhel9.id : (
128133
var.comet_ec2_ami_type == "ubuntu20" ? data.aws_ami.ubuntu20.id : (
129134
var.comet_ec2_ami_type == "ubuntu22" ? data.aws_ami.ubuntu22.id : (
130135
null))))))))

modules/comet_eks/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,26 @@ module "eks_blueprints_addons" {
140140
enable_aws_cloudwatch_metrics = var.eks_aws_cloudwatch_metrics
141141
enable_external_dns = var.eks_external_dns
142142
external_dns_route53_zone_arns = var.eks_external_dns_r53_zones
143+
}
144+
145+
resource "kubernetes_storage_class" "gp3" {
146+
metadata {
147+
name = "gp3"
148+
annotations = {
149+
"storageclass.kubernetes.io/is-default-class" = "true"
150+
}
151+
}
152+
153+
storage_provisioner = "ebs.csi.aws.com"
154+
155+
parameters = {
156+
type = "gp3"
157+
# Optionally, set iops and throughput:
158+
# iops = "3000"
159+
# throughput = "125"
160+
}
161+
162+
reclaim_policy = "Delete"
163+
volume_binding_mode = "WaitForFirstConsumer"
164+
allow_volume_expansion = true
143165
}

variables.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ variable "comet_ec2_ami_type" {
9696
description = "Operating system type for the EC2 instance AMI"
9797
default = "ubuntu22"
9898
validation {
99-
condition = can(regex("^al2$|^rhel(7|8|9)$|^ubuntu(18|20|22)$", var.comet_ec2_ami_type))
100-
error_message = "Invalid OS type. Allowed values are 'al2', 'rhel7', 'rhel8', 'rhel9', 'ubuntu18', 'ubuntu20', 'ubuntu22'."
99+
condition = can(regex("^al2$|^al2023$|^rhel(7|8|9)$|^ubuntu(18|20|22)$", var.comet_ec2_ami_type))
100+
error_message = "Invalid OS type. Allowed values are 'al2', 'al2023', 'rhel7', 'rhel8', 'rhel9', 'ubuntu20', 'ubuntu22'."
101101
}
102102
}
103103

@@ -110,7 +110,7 @@ variable "comet_ec2_ami_id" {
110110
variable "comet_ec2_instance_type" {
111111
description = "Instance type for the EC2 instance"
112112
type = string
113-
default = "m5.4xlarge"
113+
default = "m7i.4xlarge"
114114
}
115115

116116
variable "comet_ec2_instance_count" {
@@ -122,7 +122,7 @@ variable "comet_ec2_instance_count" {
122122
variable "comet_ec2_volume_type" {
123123
description = "EBS volume type for the EC2 instance root volume"
124124
type = string
125-
default = "gp2"
125+
default = "gp3"
126126
}
127127

128128
variable "comet_ec2_volume_size" {
@@ -166,13 +166,13 @@ variable "eks_mng_name" {
166166
variable "eks_mng_ami_type" {
167167
description = "AMI family to use for the EKS nodes"
168168
type = string
169-
default = "AL2_x86_64"
169+
default = "AL2023_x86_64_STANDARD"
170170
}
171171

172172
variable "eks_node_types" {
173173
description = "Node instance types for EKS managed node group"
174174
type = list(string)
175-
default = ["m6i.4xlarge"]
175+
default = ["m7i.4xlarge"]
176176
}
177177

178178
variable "eks_mng_desired_size" {

0 commit comments

Comments
 (0)