From 2d452be57f267a0f826cd8fdcf41d2c46eb54493 Mon Sep 17 00:00:00 2001 From: Rafael Pereyra <31078199+rafaelpereyra@users.noreply.github.com> Date: Thu, 26 Jan 2023 15:38:19 -0500 Subject: [PATCH] Added parameter for instance type (#91) * Added parameter for instance type See #89. Added a variable to change the default instance type for the EKS Cluster * Added additional parameters for size and version --- docs/helpers/new-eks-cluster.md | 16 ++++++++++++++++ examples/eks-cluster-with-vpc/main.tf | 6 +++--- examples/eks-cluster-with-vpc/variables.tf | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/helpers/new-eks-cluster.md b/docs/helpers/new-eks-cluster.md index 4f36d22..620015a 100644 --- a/docs/helpers/new-eks-cluster.md +++ b/docs/helpers/new-eks-cluster.md @@ -32,6 +32,22 @@ Specify the AWS Region where the resources will be deployed: export TF_VAR_aws_region=xxx ``` +### 3. Instance Type + +Depending on your region or limitations in your account, you might need to change to a different instance type. +To do this, you can define the instance type to use: +```bash +export TF_VAR_managed_node_instance_type=xxx +``` + +### 4. Anazon Elastic Kubernetes Service (Amazon EKS) Version + +You can override the version of the cluster also: +```bash +export TF_VAR_eks_version=xxx +``` + + ## Deploy Simply run this command to deploy the example diff --git a/examples/eks-cluster-with-vpc/main.tf b/examples/eks-cluster-with-vpc/main.tf index bb8cf3c..3541527 100644 --- a/examples/eks-cluster-with-vpc/main.tf +++ b/examples/eks-cluster-with-vpc/main.tf @@ -44,7 +44,7 @@ module "eks_blueprints" { source = "github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.13.1" cluster_name = local.cluster_name - cluster_version = "1.24" + cluster_version = var.eks_version vpc_id = module.vpc.vpc_id private_subnet_ids = module.vpc.private_subnets @@ -52,8 +52,8 @@ module "eks_blueprints" { managed_node_groups = { mg_5 = { node_group_name = "managed-ondemand" - instance_types = ["t3.xlarge"] - min_size = 2 + instance_types = [var.managed_node_instance_type] + min_size = var.managed_node_min_size subnet_ids = module.vpc.private_subnets } } diff --git a/examples/eks-cluster-with-vpc/variables.tf b/examples/eks-cluster-with-vpc/variables.tf index 195a197..23329cb 100644 --- a/examples/eks-cluster-with-vpc/variables.tf +++ b/examples/eks-cluster-with-vpc/variables.tf @@ -7,3 +7,18 @@ variable "aws_region" { description = "AWS Region" type = string } +variable "managed_node_instance_type" { + description = "Instance type for the cluster managed node groups" + type = string + default = "t3.xlarge" +} +variable "managed_node_min_size" { + description = "Minumum number of instances in the node group" + type = number + default = 2 +} +variable "eks_version" { + type = string + description = "EKS Cluster version" + default = "1.24" +}