Skip to content

Commit 355229e

Browse files
committed
expose all vars from comet_eks into root
1 parent 31a4817 commit 355229e

File tree

4 files changed

+144
-40
lines changed

4 files changed

+144
-40
lines changed

comet-infrastructure/main.tf

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,25 @@ module "comet_ec2_alb" {
8383
}
8484

8585
module "comet_eks" {
86-
source = "./modules/comet_eks"
87-
count = var.enable_eks ? 1 : 0
88-
86+
source = "./modules/comet_eks"
87+
count = var.enable_eks ? 1 : 0
8988
environment = var.environment
9089

91-
vpc_id = module.vpc.vpc_id
92-
vpc_private_subnets = module.vpc.private_subnets
93-
cluster_name = var.eks_cluster_name
94-
cluster_version = var.eks_cluster_version
90+
vpc_id = module.vpc.vpc_id
91+
eks_private_subnets = module.vpc.private_subnets
92+
eks_cluster_name = var.eks_cluster_name
93+
eks_cluster_version = var.eks_cluster_version
94+
eks_mng_name = var.eks_mng_name
95+
eks_mng_ami_type = var.eks_mng_ami_type
96+
eks_node_types = var.eks_node_types
97+
eks_mng_desired_size = var.eks_mng_desired_size
98+
eks_mng_max_size = var.eks_mng_max_size
99+
eks_aws_load_balancer_controller = var.eks_aws_load_balancer_controller
100+
eks_cert_manager = var.eks_cert_manager
101+
eks_aws_cloudwatch_metrics = var.eks_aws_cloudwatch_metrics
102+
eks_external_dns = var.eks_external_dns
95103

96-
s3_enabled = var.enable_s3
104+
s3_enabled = var.enable_s3
97105
comet_ec2_s3_iam_policy = var.enable_s3 ? module.comet_s3[0].comet_s3_iam_policy_arn : null
98106
}
99107

comet-infrastructure/modules/comet_eks/main.tf

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
locals {
22
tags = {
3-
Terraform = "true"
4-
Environment = var.environment
3+
Terraform = "true"
4+
Environment = var.environment
55
}
66
}
77

@@ -13,28 +13,22 @@ module "eks" {
1313
source = "terraform-aws-modules/eks/aws"
1414
version = "~> 19.9"
1515

16-
cluster_name = var.cluster_name
17-
cluster_version = var.cluster_version
16+
cluster_name = var.eks_cluster_name
17+
cluster_version = var.eks_cluster_version
1818
cluster_endpoint_public_access = true
1919

2020
vpc_id = var.vpc_id
21-
subnet_ids = var.vpc_private_subnets
21+
subnet_ids = var.eks_private_subnets
2222

23-
#manage_aws_auth_configmap = true
24-
25-
eks_managed_node_group_defaults = {
26-
ami_type = "AL2_x86_64"
27-
}
23+
eks_managed_node_group_defaults = {ami_type = var.eks_mng_ami_type}
2824

2925
eks_managed_node_groups = {
3026
one = {
31-
name = "mng"
32-
33-
instance_types = ["m5.4xlarge"]
34-
35-
min_size = 3
36-
max_size = 6
37-
desired_size = 3
27+
name = var.eks_mng_name
28+
instance_types = var.eks_node_types
29+
min_size = var.eks_mng_desired_size
30+
max_size = var.eks_mng_max_size
31+
desired_size = var.eks_mng_desired_size
3832

3933
iam_role_additional_policies = var.s3_enabled ? {comet_s3_access = var.comet_ec2_s3_iam_policy} : {}
4034
}
@@ -67,15 +61,13 @@ module "eks_blueprints_addons" {
6761
coredns = {}
6862
vpc-cni = {}
6963
kube-proxy = {}
70-
aws-ebs-csi-driver = {
71-
service_account_role_arn = module.irsa-ebs-csi.iam_role_arn
72-
}
64+
aws-ebs-csi-driver = {service_account_role_arn = module.irsa-ebs-csi.iam_role_arn}
7365
}
7466

75-
enable_aws_load_balancer_controller = true
76-
enable_cert_manager = true
77-
enable_aws_cloudwatch_metrics = true
78-
enable_external_dns = true
67+
enable_aws_load_balancer_controller = var.eks_aws_load_balancer_controller
68+
enable_cert_manager = var.eks_cert_manager
69+
enable_aws_cloudwatch_metrics = var.eks_aws_cloudwatch_metrics
70+
enable_external_dns = var.eks_external_dns
7971

8072
tags = local.tags
8173
}

comet-infrastructure/modules/comet_eks/variables.tf

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,69 @@ variable "environment" {
44
default = "dev"
55
}
66

7-
variable "cluster_name" {
7+
variable "vpc_id" {
8+
description = "ID of the VPC that the EKS cluster will be launched in"
9+
type = string
10+
}
11+
12+
variable "eks_private_subnets" {
13+
description = "IDs of private subnets within the VPC"
14+
type = list(string)
15+
}
16+
17+
variable "eks_cluster_name" {
818
description = "Name for the EKS cluster"
919
type = string
1020
}
1121

12-
variable "cluster_version" {
22+
variable "eks_cluster_version" {
1323
description = "Kubernetes version for the EKS cluster"
1424
type = string
1525
}
1626

17-
variable "vpc_id" {
18-
description = "ID of the VPC that the EKS cluster will be launched in"
27+
variable "eks_mng_name" {
28+
description = "Name for the EKS managed nodegroup"
1929
type = string
2030
}
2131

22-
variable "vpc_private_subnets" {
23-
description = "IDs of private subnets within the VPC"
32+
variable "eks_mng_ami_type" {
33+
description = "AMI family to use for the EKS nodes"
34+
type = string
35+
}
36+
37+
variable "eks_node_types" {
38+
description = "Node instance types for EKS managed node group"
2439
type = list(string)
25-
default = []
40+
}
41+
42+
variable "eks_mng_desired_size" {
43+
description = "Desired number of nodes in EKS cluster"
44+
type = number
45+
}
46+
47+
variable "eks_mng_max_size" {
48+
description = "Maximum number of nodes in EKS cluster"
49+
type = number
50+
}
51+
52+
variable "eks_aws_load_balancer_controller" {
53+
description = "Enables the AWS Load Balancer Controller in the EKS cluster"
54+
type = bool
55+
}
56+
57+
variable "eks_cert_manager" {
58+
description = "Enables cert-manager in the EKS cluster"
59+
type = bool
60+
}
61+
62+
variable "eks_aws_cloudwatch_metrics" {
63+
description = "Enables AWS Cloudwatch Metrics in the EKS cluster"
64+
type = bool
65+
}
66+
67+
variable "eks_external_dns" {
68+
description = "Enables ExternalDNS in the EKS cluster"
69+
type = bool
2670
}
2771

2872
variable "s3_enabled" {

comet-infrastructure/variables.tf

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ variable "ssl_certificate_arn" {
9292
}
9393

9494
#comet_eks
95+
variable "eks_private_subnets" {
96+
description = "IDs of private subnets within the VPC"
97+
type = list(string)
98+
default = null
99+
}
100+
95101
variable "eks_cluster_name" {
96102
description = "Name for EKS cluster"
97103
type = string
@@ -104,7 +110,61 @@ variable "eks_cluster_version" {
104110
default = "1.26"
105111
}
106112

107-
# comet_rds
113+
variable "eks_mng_name" {
114+
description = "Name for the EKS managed nodegroup"
115+
type = string
116+
default = "mng"
117+
}
118+
119+
variable "eks_mng_ami_type" {
120+
description = "AMI family to use for the EKS nodes"
121+
type = string
122+
default = "AL2_x86_64"
123+
}
124+
125+
variable "eks_node_types" {
126+
description = "Node instance types for EKS managed node group"
127+
type = list(string)
128+
default = ["m5.4xlarge"]
129+
}
130+
131+
variable "eks_mng_desired_size" {
132+
description = "Desired number of nodes in EKS cluster"
133+
type = number
134+
default = 3
135+
}
136+
137+
variable "eks_mng_max_size" {
138+
description = "Maximum number of nodes in EKS cluster"
139+
type = number
140+
default = 6
141+
}
142+
143+
variable "eks_aws_load_balancer_controller" {
144+
description = "Enables the AWS Load Balancer Controller in the EKS cluster"
145+
type = bool
146+
default = true
147+
}
148+
149+
variable "eks_cert_manager" {
150+
description = "Enables cert-manager in the EKS cluster"
151+
type = bool
152+
default = true
153+
}
154+
155+
variable "eks_aws_cloudwatch_metrics" {
156+
description = "Enables AWS Cloudwatch Metrics in the EKS cluster"
157+
type = bool
158+
default = true
159+
}
160+
161+
variable "eks_external_dns" {
162+
description = "Enables ExternalDNS in the EKS cluster"
163+
type = bool
164+
default = true
165+
}
166+
167+
#comet_rds
108168
variable "rds_root_password" {
109169
description = "Root password for RDS database"
110170
type = string

0 commit comments

Comments
 (0)