Skip to content

umotif-public/terraform-aws-eks-node-group

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub release (latest SemVer)

terraform-aws-eks-node-group

Terraform module to provision EKS Managed Node Group

Resources created

This module will create EKS managed Node Group that will join your existing Kubernetes cluster. It supports use of launch template which will allow you to further enhance and modify worker nodes.

Terraform versions

Terraform 0.12. Pin module version to ~> v4.0. Submit pull-requests to master branch.

Usage

module "eks-node-group" {
  source = "umotif-public/eks-node-group/aws"
  version = "~> 4.0.0"

  cluster_name = aws_eks_cluster.cluster.id

  node_group_name_prefix = "eks-test-"

  subnet_ids = ["subnet-1","subnet-2","subnet-3"]

  desired_size = 1
  min_size     = 1
  max_size     = 1

  instance_types = ["t3.large","t2.large"]
  capacity_type  = "SPOT"

  ec2_ssh_key = "eks-test"

  labels = {
    lifecycle = "OnDemand"
  }

  taints = [
    {
      key    = "test-1"
      value  = null
      effect = "NO_SCHEDULE"
    },
    {
      key    = "test-2"
      value  = "value-test"
      effect = "NO_EXECUTE"
    }
  ]

  force_update_version = true

  tags = {
    Environment = "test"
  }
}

Examples

Authors

Module managed by Marcin Cuber LinkedIn.

Requirements

Name Version
terraform >= 0.12.6
aws >= 3.43

Providers

Name Version
aws >= 3.43
random n/a

Modules

No modules.

Resources

Name Type
aws_eks_node_group.main resource
aws_iam_role.main resource
aws_iam_role_policy_attachment.main_AmazonEC2ContainerRegistryReadOnly resource
aws_iam_role_policy_attachment.main_AmazonEKSWorkerNodePolicy resource
aws_iam_role_policy_attachment.main_AmazonEKS_CNI_Policy resource
random_id.main resource

Inputs

Name Description Type Default Required
ami_release_version AMI version of the EKS Node Group. Defaults to latest version for Kubernetes version string null no
ami_type Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Valid values: AL2_x86_64, AL2_x86_64_GPU. Terraform will only perform drift detection if a configuration value is provided string null no
capacity_type Type of capacity associated with the EKS Node Group. Defaults to ON_DEMAND. Valid values: ON_DEMAND, SPOT. string "ON_DEMAND" no
cluster_name The name of the EKS cluster string n/a yes
create_iam_role Create IAM role for node group. Set to false if pass node_role_arn as an argument bool true no
desired_size Desired number of worker nodes number n/a yes
disk_size Disk size in GiB for worker nodes. Defaults to 20. Terraform will only perform drift detection if a configuration value is provided number null no
ec2_ssh_key SSH key name that should be used to access the worker nodes string null no
force_update_version Force version update if existing pods are unable to be drained due to a pod disruption budget issue. bool false no
instance_types List of instance types associated with the EKS Node Group. Terraform will only perform drift detection if a configuration value is provided list(string) null no
kubernetes_version Kubernetes version. Defaults to EKS Cluster Kubernetes version. Terraform will only perform drift detection if a configuration value is provided string null no
labels Key-value mapping of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed map(string) {} no
launch_template Configuration block with Launch Template settings. name, id and version parameters are available. map(string) {} no
max_size Maximum number of worker nodes number n/a yes
min_size Minimum number of worker nodes number n/a yes
node_group_name The name of the cluster node group. Defaults to <cluster_name>- string null no
node_group_name_prefix Creates a unique name beginning with the specified prefix. Conflicts with node_group_name string null no
node_group_role_name The name of the cluster node group role. Defaults to <cluster_name>-managed-group-node string "" no
node_role_arn IAM role arn that will be used by managed node group string "" no
source_security_group_ids Set of EC2 Security Group IDs to allow SSH access (port 22) from on the worker nodes. If you specify ec2_ssh_key, but do not specify this configuration when you create an EKS Node Group, port 22 on the worker nodes is opened to the Internet (0.0.0.0/0) list(string) [] no
subnet_ids A list of subnet IDs to launch resources in list(string) n/a yes
tags A map of tags (key-value pairs) passed to resources. map(string) {} no
taints List of objects containing Kubernetes taints which will be applied to the nodes in the node group. Maximum of 50 taints per node group. list(object({ key = string, value = any, effect = string })) [] no

Outputs

Name Description
iam_role_arn IAM role ARN used by node group.
iam_role_id IAM role ID used by node group.
node_group Outputs from EKS node group. See aws_eks_node_group Terraform documentation for values

License

See LICENSE for full details.

Pre-commit hooks

Install dependencies

MacOS
brew install pre-commit terraform-docs tflint

brew tap git-chglog/git-chglog
brew install git-chglog