Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Parameterize number of kubernetes nodes #138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ module "app_eks" {
kms_key_arn = local.kms_key_arn

instance_types = var.kubernetes_instance_types
desired_nodes = var.kubernetes_desired_nodes
max_nodes = var.kubernetes_max_nodes
min_nodes = var.kubernetes_min_nodes
map_accounts = var.kubernetes_map_accounts
map_roles = var.kubernetes_map_roles
map_users = var.kubernetes_map_users
Expand Down
6 changes: 3 additions & 3 deletions modules/app_eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ module "eks" {
node_groups = {
primary = {
version = var.cluster_version,
desired_capacity = 2,
max_capacity = 5,
min_capacity = 2,
desired_capacity = var.desired_nodes,
max_capacity = var.max_nodes,
min_capacity = var.min_nodes,
instance_types = var.instance_types,
iam_role_arn = aws_iam_role.node.arn,
create_launch_template = local.encrypt_ebs_volume,
Expand Down
14 changes: 14 additions & 0 deletions modules/app_eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,17 @@ variable "service_port" {
default = 32543
}

variable "desired_nodes" {
type = number
description = "(Required) Desired number of nodes in EKS"
}

variable "max_nodes" {
type = number
description = "(Required) Max number of nodes in EKS"
}

variable "min_nodes" {
type = number
description = "(Required) Min number of nodes in EKS"
}
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,24 @@ variable "kubernetes_instance_types" {
default = ["m5.large"]
}

variable "kubernetes_desired_nodes" {
type = number
description = "(Optional) Desired number of nodes in EKS"
default = 2
}

variable "kubernetes_max_nodes" {
type = number
description = "(Optional) Max number of nodes in EKS"
default = 5
}

variable "kubernetes_min_nodes" {
type = number
description = "(Optional) Min number of nodes in EKS"
default = 2
}

variable "eks_policy_arns" {
type = list(string)
description = "Additional IAM policy to apply to the EKS cluster"
Expand Down