Awesome
<!-- markdownlint-disable --><a href="https://cpco.io/homepage"><img src="https://github.com/cloudposse/terraform-aws-eks-cluster/blob/main/.github/banner.png?raw=true" alt="Project Banner"/></a><br/> <p align="right"> <a href="https://github.com/cloudposse/terraform-aws-eks-cluster/releases/latest"><img src="https://img.shields.io/github/release/cloudposse/terraform-aws-eks-cluster.svg?style=for-the-badge" alt="Latest Release"/></a><a href="https://github.com/cloudposse/terraform-aws-eks-cluster/commits"><img src="https://img.shields.io/github/last-commit/cloudposse/terraform-aws-eks-cluster.svg?style=for-the-badge" alt="Last Updated"/></a><a href="https://slack.cloudposse.com"><img src="https://slack.cloudposse.com/for-the-badge.svg" alt="Slack Community"/></a></p>
<!-- markdownlint-restore --> <!-- ** DO NOT EDIT THIS FILE ** ** This file was automatically generated by the `cloudposse/build-harness`. ** 1) Make all changes to `README.yaml` ** 2) Run `make init` (you only need to do this once) ** 3) Run`make readme` to rebuild this file. ** ** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.) ** -->Terraform module to provision an EKS cluster on AWS. <br/><br/> This Terraform module provisions a fully-configured AWS EKS (Elastic Kubernetes Service) cluster. It's engineered to integrate smoothly with Karpenter and EKS addons, forming a critical part of Cloud Posse's reference architecture. Ideal for teams looking to deploy scalable and manageable Kubernetes clusters on AWS with minimal fuss.
[!TIP]
π½ Use Atmos with Terraform
Cloud Posse uses
<details> <summary><strong>Watch demo of using Atmos with Terraform</strong></summary> <img src="https://github.com/cloudposse/atmos/blob/main/docs/demo.gif?raw=true"/><br/> <i>Example of running <a href="https://atmos.tools"><code>atmos</code></a> to manage infrastructure from our <a href="https://atmos.tools/quick-start/">Quick Start</a> tutorial.</i> </detalis>atmos
to easily orchestrate multiple environments using Terraform. <br/> Works with Github Actions, Atlantis, or Spacelift.
Introduction
The module provisions the following resources:
- EKS cluster of master nodes that can be used together with the
terraform-aws-eks-node-group and
terraform-aws-eks-fargate-profile
modules to create a full-blown EKS/Kubernetes cluster. You can also use the terraform-aws-eks-workers
module to provision worker nodes for the cluster, but it is now rare for that to be a better choice than to use
terraform-aws-eks-node-group
. - IAM Role to allow the cluster to access other AWS services
- EKS access entries to allow IAM users to access and administer the cluster
Usage
For a complete example, see examples/complete.
For automated tests of the complete example using bats and Terratest (which tests and deploys the example on AWS), see test/src.
Other examples:
- terraform-aws-components/eks/cluster - Cloud Posse's service catalog of "root module" invocations for provisioning reference architectures
provider "aws" {
region = var.region
}
# Note: This example creates an explicit access entry for the current user,
# but in practice, you should use a static map of IAM users or roles that should have access to the cluster.
# Granting access to the current user in this way is not recommended for production use.
data "aws_caller_identity" "current" {}
# IAM session context converts an assumed role ARN into an IAM Role ARN.
# Again, this is primarily to simplify the example, and in practice, you should use a static map of IAM users or roles.
data "aws_iam_session_context" "current" {
arn = data.aws_caller_identity.current.arn
}
locals {
# The usage of the specific kubernetes.io/cluster/* resource tags below are required
# for EKS and Kubernetes to discover and manage networking resources
# https://aws.amazon.com/premiumsupport/knowledge-center/eks-vpc-subnet-discovery/
# https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/deploy/subnet_discovery.md
tags = { "kubernetes.io/cluster/${module.label.id}" = "shared" }
# required tags to make ALB ingress work https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html
public_subnets_additional_tags = {
"kubernetes.io/role/elb" : 1
}
private_subnets_additional_tags = {
"kubernetes.io/role/internal-elb" : 1
}
# Enable the IAM user creating the cluster to administer it,
# without using the bootstrap_cluster_creator_admin_permissions option,
# as an example of how to use the access_entry_map feature.
# In practice, this should be replaced with a static map of IAM users or roles
# that should have access to the cluster, but we use the current user
# to simplify the example.
access_entry_map = {
(data.aws_iam_session_context.current.issuer_arn) = {
access_policy_associations = {
ClusterAdmin = {}
}
}
}
}
module "label" {
source = "cloudposse/label/null"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
namespace = var.namespace
name = var.name
stage = var.stage
delimiter = var.delimiter
tags = var.tags
}
module "vpc" {
source = "cloudposse/vpc/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
ipv4_primary_cidr_block = "172.16.0.0/16"
tags = local.tags
context = module.label.context
}
module "subnets" {
source = "cloudposse/dynamic-subnets/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
availability_zones = var.availability_zones
vpc_id = module.vpc.vpc_id
igw_id = [module.vpc.igw_id]
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
nat_gateway_enabled = true
nat_instance_enabled = false
public_subnets_additional_tags = local.public_subnets_additional_tags
private_subnets_additional_tags = local.private_subnets_additional_tags
tags = local.tags
context = module.label.context
}
module "eks_node_group" {
source = "cloudposse/eks-node-group/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
instance_types = [var.instance_type]
subnet_ids = module.subnets.private_subnet_ids
health_check_type = var.health_check_type
min_size = var.min_size
max_size = var.max_size
cluster_name = module.eks_cluster.eks_cluster_id
# Enable the Kubernetes cluster auto-scaler to find the auto-scaling group
cluster_autoscaler_enabled = var.autoscaling_policies_enabled
context = module.label.context
}
module "eks_cluster" {
source = "cloudposse/eks-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
subnet_ids = concat(module.subnets.private_subnet_ids, module.subnets.public_subnet_ids)
kubernetes_version = var.kubernetes_version
oidc_provider_enabled = true
addons = [
# https://docs.aws.amazon.com/eks/latest/userguide/managing-vpc-cni.html#vpc-cni-latest-available-version
{
addon_name = "vpc-cni"
addon_version = var.vpc_cni_version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
service_account_role_arn = var.vpc_cni_service_account_role_arn # Creating this role is outside the scope of this example
},
# https://docs.aws.amazon.com/eks/latest/userguide/managing-kube-proxy.html
{
addon_name = "kube-proxy"
addon_version = var.kube_proxy_version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
service_account_role_arn = null
},
# https://docs.aws.amazon.com/eks/latest/userguide/managing-coredns.html
{
addon_name = "coredns"
addon_version = var.coredns_version
resolve_conflicts_on_create = "OVERWRITE"
resolve_conflicts_on_update = "OVERWRITE"
service_account_role_arn = null
},
]
addons_depends_on = [module.eks_node_group]
context = module.label.context
cluster_depends_on = [module.subnets]
}
Module usage with two unmanaged worker groups:
locals {
# Unfortunately, the `aws_ami` data source attribute `most_recent` (https://github.com/cloudposse/terraform-aws-eks-workers/blob/34a43c25624a6efb3ba5d2770a601d7cb3c0d391/main.tf#L141)
# does not work as you might expect. If you are not going to use a custom AMI you should
# use the `eks_worker_ami_name_filter` variable to set the right kubernetes version for EKS workers,
# otherwise the first version of Kubernetes supported by AWS (v1.11) for EKS workers will be selected, but the
# EKS control plane will ignore it to use one that matches the version specified by the `kubernetes_version` variable.
eks_worker_ami_name_filter = "amazon-eks-node-${var.kubernetes_version}*"
}
module "eks_workers" {
source = "cloudposse/eks-workers/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
attributes = ["small"]
instance_type = "t3.small"
eks_worker_ami_name_filter = local.eks_worker_ami_name_filter
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_ids
health_check_type = var.health_check_type
min_size = var.min_size
max_size = var.max_size
wait_for_capacity_timeout = var.wait_for_capacity_timeout
cluster_name = module.label.id
cluster_endpoint = module.eks_cluster.eks_cluster_endpoint
cluster_certificate_authority_data = module.eks_cluster.eks_cluster_certificate_authority_data
cluster_security_group_id = module.eks_cluster.eks_cluster_managed_security_group_id
# Auto-scaling policies and CloudWatch metric alarms
autoscaling_policies_enabled = var.autoscaling_policies_enabled
cpu_utilization_high_threshold_percent = var.cpu_utilization_high_threshold_percent
cpu_utilization_low_threshold_percent = var.cpu_utilization_low_threshold_percent
context = module.label.context
}
module "eks_workers_2" {
source = "cloudposse/eks-workers/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
attributes = ["medium"]
instance_type = "t3.medium"
eks_worker_ami_name_filter = local.eks_worker_ami_name_filter
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_ids
health_check_type = var.health_check_type
min_size = var.min_size
max_size = var.max_size
wait_for_capacity_timeout = var.wait_for_capacity_timeout
cluster_name = module.label.id
cluster_endpoint = module.eks_cluster.eks_cluster_endpoint
cluster_certificate_authority_data = module.eks_cluster.eks_cluster_certificate_authority_data
cluster_security_group_id = module.eks_cluster.eks_cluster_managed_security_group_id
# Auto-scaling policies and CloudWatch metric alarms
autoscaling_policies_enabled = var.autoscaling_policies_enabled
cpu_utilization_high_threshold_percent = var.cpu_utilization_high_threshold_percent
cpu_utilization_low_threshold_percent = var.cpu_utilization_low_threshold_percent
context = module.label.context
}
module "eks_cluster" {
source = "cloudposse/eks-cluster/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
subnet_ids = concat(module.subnets.private_subnet_ids, module.subnets.public_subnet_ids)
kubernetes_version = var.kubernetes_version
oidc_provider_enabled = true # needed for VPC CNI
access_entries_for_nodes = {
EC2_LINUX = [module.eks_workers.workers_role_arn, module.eks_workers_2.workers_role_arn]
}
context = module.label.context
}
[!WARNING] Release
4.0.0
contains major breaking changes that will require you to update your existing EKS cluster and configuration to use this module. Please see the v3 to v4 migration path for more information. Release2.0.0
(previously released as version0.45.0
) contains some changes that, if applied to a cluster created with an earlier version of this module, could result in your existing EKS cluster being replaced (destroyed and recreated). To prevent this, follow the instructions in the v1 to v2 migration path.
[!NOTE] Prior to v4 of this module, AWS did not provide an API to manage access to the EKS cluster, causing numerous challenges. With v4 of this module, it exclusively uses the AWS API, resolving many issues you may read about that had affected prior versions. See the version 2 README and release notes for more information on the challenges and workarounds that were required prior to v3.
<!-- markdownlint-disable -->[!IMPORTANT] In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version you're using. This practice ensures the stability of your infrastructure. Additionally, we recommend implementing a systematic approach for updating versions to avoid unexpected changes.
Makefile Targets
Available targets:
help Help screen
help/all Display help for all targets
help/short This help short screen
lint Lint terraform code
<!-- markdownlint-restore -->
<!-- markdownlint-disable -->
Requirements
Name | Version |
---|---|
<a name="requirement_terraform"></a> terraform | >= 1.3.0 |
<a name="requirement_aws"></a> aws | >= 5.74.0 |
<a name="requirement_tls"></a> tls | >= 3.1.0, != 4.0.0 |
Providers
Name | Version |
---|---|
<a name="provider_aws"></a> aws | >= 5.74.0 |
<a name="provider_tls"></a> tls | >= 3.1.0, != 4.0.0 |
Modules
Name | Source | Version |
---|---|---|
<a name="module_label"></a> label | cloudposse/label/null | 0.25.0 |
<a name="module_this"></a> this | cloudposse/label/null | 0.25.0 |
Resources
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
<a name="input_access_config"></a> access_config | Access configuration for the EKS cluster. | <pre>object({<br/> authentication_mode = optional(string, "API")<br/> bootstrap_cluster_creator_admin_permissions = optional(bool, false)<br/> })</pre> | {} | no |
<a name="input_access_entries"></a> access_entries | List of IAM principles to allow to access the EKS cluster.<br/>It is recommended to use the default user_name because the default includes<br/>the IAM role or user name and the session name for assumed roles.<br/>Use when Principal ARN is not known at plan time. | <pre>list(object({<br/> principal_arn = string<br/> user_name = optional(string, null)<br/> kubernetes_groups = optional(list(string), null)<br/> }))</pre> | [] | no |
<a name="input_access_entries_for_nodes"></a> access_entries_for_nodes | Map of list of IAM roles for the EKS non-managed worker nodes.<br/>The map key is the node type, either EC2_LINUX or EC2_WINDOWS ,<br/>and the list contains the IAM roles of the nodes of that type.<br/>There is no need for or utility in creating Fargate access entries, as those<br/>are always created automatically by AWS, just as with managed nodes.<br/>Use when Principal ARN is not known at plan time. | map(list(string)) | {} | no |
<a name="input_access_entry_map"></a> access_entry_map | Map of IAM Principal ARNs to access configuration.<br/>Preferred over other inputs as this configuration remains stable<br/>when elements are added or removed, but it requires that the Principal ARNs<br/>and Policy ARNs are known at plan time.<br/>Can be used along with other access_* inputs, but do not duplicate entries.<br/>Map access_policy_associations keys are policy ARNs, policy<br/>full name (AmazonEKSViewPolicy), or short name (View).<br/>It is recommended to use the default user_name because the default includes<br/>IAM role or user name and the session name for assumed roles.<br/>As a special case in support of backwards compatibility, membership in the<br/>system:masters group is is translated to an association with the ClusterAdmin policy.<br/>In all other cases, including any system:* group in kubernetes_groups is prohibited. | <pre>map(object({<br/> # key is principal_arn<br/> user_name = optional(string)<br/> # Cannot assign "system:*" groups to IAM users, use ClusterAdmin and Admin instead<br/> kubernetes_groups = optional(list(string), [])<br/> type = optional(string, "STANDARD")<br/> access_policy_associations = optional(map(object({<br/> # key is policy_arn or policy_name<br/> access_scope = optional(object({<br/> type = optional(string, "cluster")<br/> namespaces = optional(list(string))<br/> }), {}) # access_scope<br/> })), {}) # access_policy_associations<br/> }))</pre> | {} | no |
<a name="input_access_policy_associations"></a> access_policy_associations | List of AWS managed EKS access policies to associate with IAM principles.<br/>Use when Principal ARN or Policy ARN is not known at plan time.<br/>policy_arn can be the full ARN, the full name (AmazonEKSViewPolicy) or short name (View). | <pre>list(object({<br/> principal_arn = string<br/> policy_arn = string<br/> access_scope = object({<br/> type = optional(string, "cluster")<br/> namespaces = optional(list(string))<br/> })<br/> }))</pre> | [] | no |
<a name="input_additional_tag_map"></a> additional_tag_map | Additional key-value pairs to add to each map in tags_as_list_of_maps . Not added to tags or id .<br/>This is for some rare cases where resources want additional configuration of tags<br/>and therefore take a list of maps with tag key, value, and additional configuration. | map(string) | {} | no |
<a name="input_addons"></a> addons | Manages aws_eks_addon resources.<br/>Note: resolve_conflicts is deprecated. If resolve_conflicts is set and<br/>resolve_conflicts_on_create or resolve_conflicts_on_update is not set,<br/>resolve_conflicts will be used instead. If resolve_conflicts_on_create is<br/>not set and resolve_conflicts is PRESERVE , resolve_conflicts_on_create <br/>will be set to NONE . | <pre>list(object({<br/> addon_name = string<br/> addon_version = optional(string, null)<br/> configuration_values = optional(string, null)<br/> # resolve_conflicts is deprecated, but we keep it for backwards compatibility<br/> # and because if not declared, Terraform will silently ignore it.<br/> resolve_conflicts = optional(string, null)<br/> resolve_conflicts_on_create = optional(string, null)<br/> resolve_conflicts_on_update = optional(string, null)<br/> service_account_role_arn = optional(string, null)<br/> create_timeout = optional(string, null)<br/> update_timeout = optional(string, null)<br/> delete_timeout = optional(string, null)<br/> }))</pre> | [] | no |
<a name="input_addons_depends_on"></a> addons_depends_on | If provided, all addons will depend on this object, and therefore not be installed until this object is finalized.<br/>This is useful if you want to ensure that addons are not applied before some other condition is met, e.g. node groups are created.<br/>See issue #170 for more details. | any | null | no |
<a name="input_allowed_cidr_blocks"></a> allowed_cidr_blocks | A list of IPv4 CIDRs to allow access to the cluster.<br/>The length of this list must be known at "plan" time. | list(string) | [] | no |
<a name="input_allowed_security_group_ids"></a> allowed_security_group_ids | A list of IDs of Security Groups to allow access to the cluster. | list(string) | [] | no |
<a name="input_associated_security_group_ids"></a> associated_security_group_ids | A list of IDs of Security Groups to associate the cluster with.<br/>These security groups will not be modified. | list(string) | [] | no |
<a name="input_attributes"></a> attributes | ID element. Additional attributes (e.g. workers or cluster ) to add to id ,<br/>in the order they appear in the list. New attributes are appended to the<br/>end of the list. The elements of the list are joined by the delimiter <br/>and treated as a single ID element. | list(string) | [] | no |
<a name="input_bootstrap_self_managed_addons_enabled"></a> bootstrap_self_managed_addons_enabled | Manages bootstrap of default networking addons after cluster has been created | bool | null | no |
<a name="input_cloudwatch_log_group_class"></a> cloudwatch_log_group_class | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS | string | null | no |
<a name="input_cloudwatch_log_group_kms_key_id"></a> cloudwatch_log_group_kms_key_id | If provided, the KMS Key ID to use to encrypt AWS CloudWatch logs | string | null | no |
<a name="input_cluster_attributes"></a> cluster_attributes | Override label module default cluster attributes | list(string) | <pre>[<br/> "cluster"<br/>]</pre> | no |
<a name="input_cluster_depends_on"></a> cluster_depends_on | If provided, the EKS will depend on this object, and therefore not be created until this object is finalized.<br/>This is useful if you want to ensure that the cluster is not created before some other condition is met, e.g. VPNs into the subnet are created. | any | null | no |
<a name="input_cluster_encryption_config_enabled"></a> cluster_encryption_config_enabled | Set to true to enable Cluster Encryption Configuration | bool | true | no |
<a name="input_cluster_encryption_config_kms_key_deletion_window_in_days"></a> cluster_encryption_config_kms_key_deletion_window_in_days | Cluster Encryption Config KMS Key Resource argument - key deletion windows in days post destruction | number | 10 | no |
<a name="input_cluster_encryption_config_kms_key_enable_key_rotation"></a> cluster_encryption_config_kms_key_enable_key_rotation | Cluster Encryption Config KMS Key Resource argument - enable kms key rotation | bool | true | no |
<a name="input_cluster_encryption_config_kms_key_id"></a> cluster_encryption_config_kms_key_id | KMS Key ID to use for cluster encryption config | string | "" | no |
<a name="input_cluster_encryption_config_kms_key_policy"></a> cluster_encryption_config_kms_key_policy | Cluster Encryption Config KMS Key Resource argument - key policy | string | null | no |
<a name="input_cluster_encryption_config_resources"></a> cluster_encryption_config_resources | Cluster Encryption Config Resources to encrypt, e.g. ['secrets'] | list(any) | <pre>[<br/> "secrets"<br/>]</pre> | no |
<a name="input_cluster_log_retention_period"></a> cluster_log_retention_period | Number of days to retain cluster logs. Requires enabled_cluster_log_types to be set. See https://docs.aws.amazon.com/en_us/eks/latest/userguide/control-plane-logs.html. | number | 0 | no |
<a name="input_context"></a> context | Single object for setting entire context at once.<br/>See description of individual variables for details.<br/>Leave string and numeric variables as null to use default value.<br/>Individual variable settings (non-null) override settings in context object,<br/>except for attributes, tags, and additional_tag_map, which are merged. | any | <pre>{<br/> "additional_tag_map": {},<br/> "attributes": [],<br/> "delimiter": null,<br/> "descriptor_formats": {},<br/> "enabled": true,<br/> "environment": null,<br/> "id_length_limit": null,<br/> "label_key_case": null,<br/> "label_order": [],<br/> "label_value_case": null,<br/> "labels_as_tags": [<br/> "unset"<br/> ],<br/> "name": null,<br/> "namespace": null,<br/> "regex_replace_chars": null,<br/> "stage": null,<br/> "tags": {},<br/> "tenant": null<br/>}</pre> | no |
<a name="input_create_eks_service_role"></a> create_eks_service_role | Set false to use existing eks_cluster_service_role_arn instead of creating one | bool | true | no |
<a name="input_custom_ingress_rules"></a> custom_ingress_rules | A List of Objects, which are custom security group rules that | <pre>list(object({<br/> description = string<br/> from_port = number<br/> to_port = number<br/> protocol = string<br/> source_security_group_id = string<br/> }))</pre> | [] | no |
<a name="input_delimiter"></a> delimiter | Delimiter to be used between ID elements.<br/>Defaults to - (hyphen). Set to "" to use no delimiter at all. | string | null | no |
<a name="input_descriptor_formats"></a> descriptor_formats | Describe additional descriptors to be output in the descriptors output map.<br/>Map of maps. Keys are names of descriptors. Values are maps of the form<br/>{<br/> format = string<br/> labels = list(string)<br/>} <br/>(Type is any so the map values can later be enhanced to provide additional options.)<br/>format is a Terraform format string to be passed to the format() function.<br/>labels is a list of labels, in order, to pass to format() function.<br/>Label values will be normalized before being passed to format() so they will be<br/>identical to how they appear in id .<br/>Default is {} (descriptors output will be empty). | any | {} | no |
<a name="input_eks_cluster_service_role_arn"></a> eks_cluster_service_role_arn | The ARN of an IAM role for the EKS cluster to use that provides permissions<br/>for the Kubernetes control plane to perform needed AWS API operations.<br/>Required if create_eks_service_role is false , ignored otherwise. | string | null | no |
<a name="input_enabled"></a> enabled | Set to false to prevent the module from creating any resources | bool | null | no |
<a name="input_enabled_cluster_log_types"></a> enabled_cluster_log_types | A list of the desired control plane logging to enable. For more information, see https://docs.aws.amazon.com/en_us/eks/latest/userguide/control-plane-logs.html. Possible values [api , audit , authenticator , controllerManager , scheduler ] | list(string) | [] | no |
<a name="input_endpoint_private_access"></a> endpoint_private_access | Indicates whether or not the Amazon EKS private API server endpoint is enabled. Default to AWS EKS resource and it is false | bool | false | no |
<a name="input_endpoint_public_access"></a> endpoint_public_access | Indicates whether or not the Amazon EKS public API server endpoint is enabled. Default to AWS EKS resource and it is true | bool | true | no |
<a name="input_environment"></a> environment | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | string | null | no |
<a name="input_id_length_limit"></a> id_length_limit | Limit id to this many characters (minimum 6).<br/>Set to 0 for unlimited length.<br/>Set to null for keep the existing setting, which defaults to 0 .<br/>Does not affect id_full . | number | null | no |
<a name="input_kubernetes_network_ipv6_enabled"></a> kubernetes_network_ipv6_enabled | Set true to use IPv6 addresses for Kubernetes pods and services | bool | false | no |
<a name="input_kubernetes_version"></a> kubernetes_version | Desired Kubernetes master version. If you do not specify a value, the latest available version is used | string | "1.21" | no |
<a name="input_label_key_case"></a> label_key_case | Controls the letter case of the tags keys (label names) for tags generated by this module.<br/>Does not affect keys of tags passed in via the tags input.<br/>Possible values: lower , title , upper .<br/>Default value: title . | string | null | no |
<a name="input_label_order"></a> label_order | The order in which the labels (ID elements) appear in the id .<br/>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br/>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | list(string) | null | no |
<a name="input_label_value_case"></a> label_value_case | Controls the letter case of ID elements (labels) as included in id ,<br/>set as tag values, and output by this module individually.<br/>Does not affect values of tags passed in via the tags input.<br/>Possible values: lower , title , upper and none (no transformation).<br/>Set this to title and set delimiter to "" to yield Pascal Case IDs.<br/>Default value: lower . | string | null | no |
<a name="input_labels_as_tags"></a> labels_as_tags | Set of labels (ID elements) to include as tags in the tags output.<br/>Default is to include all labels.<br/>Tags with empty values will not be included in the tags output.<br/>Set to [] to suppress all generated tags.<br/>Notes:<br/> The value of the name tag, if included, will be the id , not the name .<br/> Unlike other null-label inputs, the initial setting of labels_as_tags cannot be<br/> changed in later chained modules. Attempts to change it will be silently ignored. | set(string) | <pre>[<br/> "default"<br/>]</pre> | no |
<a name="input_managed_security_group_rules_enabled"></a> managed_security_group_rules_enabled | Flag to enable/disable the ingress and egress rules for the EKS managed Security Group | bool | true | no |
<a name="input_name"></a> name | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br/>This is the only ID element not also included as a tag .<br/>The "name" tag is set to the full id string. There is no tag with the value of the name input. | string | null | no |
<a name="input_namespace"></a> namespace | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | string | null | no |
<a name="input_oidc_provider_enabled"></a> oidc_provider_enabled | Create an IAM OIDC identity provider for the cluster, then you can create IAM roles to associate with a<br/>service account in the cluster, instead of using kiam or kube2iam. For more information,<br/>see EKS User Guide. | bool | false | no |
<a name="input_permissions_boundary"></a> permissions_boundary | If provided, all IAM roles will be created with this permissions boundary attached | string | null | no |
<a name="input_public_access_cidrs"></a> public_access_cidrs | Indicates which CIDR blocks can access the Amazon EKS public API server endpoint when enabled. EKS defaults this to a list with 0.0.0.0/0. | list(string) | <pre>[<br/> "0.0.0.0/0"<br/>]</pre> | no |
<a name="input_regex_replace_chars"></a> regex_replace_chars | Terraform regular expression (regex) string.<br/>Characters matching the regex will be removed from the ID elements.<br/>If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits. | string | null | no |
<a name="input_region"></a> region | OBSOLETE (not needed): AWS Region | string | null | no |
<a name="input_service_ipv4_cidr"></a> service_ipv4_cidr | The CIDR block to assign Kubernetes service IP addresses from.<br/>You can only specify a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created. | string | null | no |
<a name="input_stage"></a> stage | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | string | null | no |
<a name="input_subnet_ids"></a> subnet_ids | A list of subnet IDs to launch the cluster in | list(string) | n/a | yes |
<a name="input_tags"></a> tags | Additional tags (e.g. {'BusinessUnit': 'XYZ'} ).<br/>Neither the tag keys nor the tag values will be modified by this module. | map(string) | {} | no |
<a name="input_tenant"></a> tenant | ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for | string | null | no |
<a name="input_upgrade_policy"></a> upgrade_policy | Configuration block for the support policy to use for the cluster | <pre>object({<br/> support_type = optional(string, null)<br/> })</pre> | null | no |
<a name="input_zonal_shift_config"></a> zonal_shift_config | Configuration block with zonal shift configuration for the cluster | <pre>object({<br/> enabled = optional(bool, null)<br/> })</pre> | null | no |
Outputs
Name | Description |
---|---|
<a name="output_cloudwatch_log_group_kms_key_id"></a> cloudwatch_log_group_kms_key_id | KMS Key ID to encrypt AWS CloudWatch logs |
<a name="output_cloudwatch_log_group_name"></a> cloudwatch_log_group_name | The name of the log group created in cloudwatch where cluster logs are forwarded to if enabled |
<a name="output_cluster_encryption_config_enabled"></a> cluster_encryption_config_enabled | If true, Cluster Encryption Configuration is enabled |
<a name="output_cluster_encryption_config_provider_key_alias"></a> cluster_encryption_config_provider_key_alias | Cluster Encryption Config KMS Key Alias ARN |
<a name="output_cluster_encryption_config_provider_key_arn"></a> cluster_encryption_config_provider_key_arn | Cluster Encryption Config KMS Key ARN |
<a name="output_cluster_encryption_config_resources"></a> cluster_encryption_config_resources | Cluster Encryption Config Resources |
<a name="output_eks_addons_versions"></a> eks_addons_versions | Map of enabled EKS Addons names and versions |
<a name="output_eks_cluster_arn"></a> eks_cluster_arn | The Amazon Resource Name (ARN) of the cluster |
<a name="output_eks_cluster_certificate_authority_data"></a> eks_cluster_certificate_authority_data | The Kubernetes cluster certificate authority data |
<a name="output_eks_cluster_endpoint"></a> eks_cluster_endpoint | The endpoint for the Kubernetes API server |
<a name="output_eks_cluster_id"></a> eks_cluster_id | The name of the cluster |
<a name="output_eks_cluster_identity_oidc_issuer"></a> eks_cluster_identity_oidc_issuer | The OIDC Identity issuer for the cluster |
<a name="output_eks_cluster_identity_oidc_issuer_arn"></a> eks_cluster_identity_oidc_issuer_arn | The OIDC Identity issuer ARN for the cluster that can be used to associate IAM roles with a service account |
<a name="output_eks_cluster_ipv4_service_cidr"></a> eks_cluster_ipv4_service_cidr | The IPv4 CIDR block that Kubernetes pod and service IP addresses are assigned from<br/>if kubernetes_network_ipv6_enabled is set to false. If set to true this output will be null. |
<a name="output_eks_cluster_ipv6_service_cidr"></a> eks_cluster_ipv6_service_cidr | The IPv6 CIDR block that Kubernetes pod and service IP addresses are assigned from<br/>if kubernetes_network_ipv6_enabled is set to true. If set to false this output will be null. |
<a name="output_eks_cluster_managed_security_group_id"></a> eks_cluster_managed_security_group_id | Security Group ID that was created by EKS for the cluster.<br/>EKS creates a Security Group and applies it to the ENI that are attached to EKS Control Plane master nodes and to any managed workloads. |
<a name="output_eks_cluster_role_arn"></a> eks_cluster_role_arn | ARN of the EKS cluster IAM role |
<a name="output_eks_cluster_version"></a> eks_cluster_version | The Kubernetes server version of the cluster |
Related Projects
Check out these related projects.
- terraform-aws-components eks/clusters - Cloud Posse's component (root module) using this module to provision an EKS cluster
- terraform-aws-components eks/karpenter and eks/karpenter-provisioner - Cloud Posse's components (root modules) deploying Karpenter to manage auto-scaling of EKS node groups
- terraform-aws-eks-workers - Terraform module to provision an AWS AutoScaling Group, IAM Role, and Security Group for EKS Workers
- terraform-aws-ec2-autoscale-group - Terraform module to provision Auto Scaling Group and Launch Template on AWS
- terraform-aws-ecs-container-definition - Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
- terraform-aws-ecs-alb-service-task - Terraform module which implements an ECS service which exposes a web service via ALB
- terraform-aws-ecs-web-app - Terraform module that implements a web app on ECS and supports autoscaling, CI/CD, monitoring, ALB integration, and much more
- terraform-aws-ecs-codepipeline - Terraform module for CI/CD with AWS Code Pipeline and Code Build for ECS
- terraform-aws-ecs-cloudwatch-autoscaling - Terraform module to autoscale ECS Service based on CloudWatch metrics
- terraform-aws-ecs-cloudwatch-sns-alarms - Terraform module to create CloudWatch Alarms on ECS Service level metrics
- terraform-aws-ec2-instance - Terraform module for providing a general purpose EC2 instance
- terraform-aws-ec2-instance-group - Terraform module for provisioning multiple general purpose EC2 hosts for stateful applications
[!TIP]
Use Terraform Reference Architectures for AWS
Use Cloud Posse's ready-to-go terraform architecture blueprints for AWS to get up and running quickly.
β We build it together with your team.<br/> β Your team owns everything.<br/> β 100% Open Source and backed by fanatical support.<br/>
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-eks-cluster&utm_content=commercial_support"><img alt="Request Quote" src="https://img.shields.io/badge/request%20quote-success.svg?style=for-the-badge"/></a>
<details><summary>π <strong>Learn More</strong></summary> <br/>Cloud Posse is the leading DevOps Accelerator for funded startups and enterprises.
Your team can operate like a pro today.
Ensure that your team succeeds by using Cloud Posse's proven process and turnkey blueprints. Plus, we stick around until you succeed.
Day-0: Your Foundation for Success
- Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
- Deployment Strategy. Adopt a proven deployment strategy with GitHub Actions, enabling automated, repeatable, and reliable software releases.
- Site Reliability Engineering. Gain total visibility into your applications and services with Datadog, ensuring high availability and performance.
- Security Baseline. Establish a secure environment from the start, with built-in governance, accountability, and comprehensive audit logs, safeguarding your operations.
- GitOps. Empower your team to manage infrastructure changes confidently and efficiently through Pull Requests, leveraging the full power of GitHub Actions.
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-eks-cluster&utm_content=commercial_support"><img alt="Request Quote" src="https://img.shields.io/badge/request%20quote-success.svg?style=for-the-badge"/></a>
Day-2: Your Operational Mastery
- Training. Equip your team with the knowledge and skills to confidently manage the infrastructure, ensuring long-term success and self-sufficiency.
- Support. Benefit from a seamless communication over Slack with our experts, ensuring you have the support you need, whenever you need it.
- Troubleshooting. Access expert assistance to quickly resolve any operational challenges, minimizing downtime and maintaining business continuity.
- Code Reviews. Enhance your teamβs code quality with our expert feedback, fostering continuous improvement and collaboration.
- Bug Fixes. Rely on our team to troubleshoot and resolve any issues, ensuring your systems run smoothly.
- Migration Assistance. Accelerate your migration process with our dedicated support, minimizing disruption and speeding up time-to-value.
- Customer Workshops. Engage with our team in weekly workshops, gaining insights and strategies to continuously improve and innovate.
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-eks-cluster&utm_content=commercial_support"><img alt="Request Quote" src="https://img.shields.io/badge/request%20quote-success.svg?style=for-the-badge"/></a>
</details>
β¨ Contributing
This project is under active development, and we encourage contributions from our community.
Many thanks to our outstanding contributors:
<a href="https://github.com/cloudposse/terraform-aws-eks-cluster/graphs/contributors"> <img src="https://contrib.rocks/image?repo=cloudposse/terraform-aws-eks-cluster&max=24" /> </a>For π bug reports & feature requests, please use the issue tracker.
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
- Review our Code of Conduct and Contributor Guidelines.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull Request so that we can review your changes
NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!
π Slack Community
Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.
π° Newsletter
Sign up for our newsletter and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know. Dropped straight into your Inbox every week β and usually a 5-minute read.
π Office Hours <a href="https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-eks-cluster&utm_content=office_hours"><img src="https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png" align="right" /></a>
Join us every Wednesday via Zoom for your weekly dose of insider DevOps trends, AWS news and Terraform insights, all sourced from our SweetOps community, plus a live Q&A that you canβt find anywhere else. It's FREE for everyone!
License
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge" alt="License"></a>
<details> <summary>Preamble to the Apache License, Version 2.0</summary> <br/> <br/>Complete license is available in the LICENSE
file.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
</details>
Trademarks
All other trademarks referenced herein are the property of their respective owners.
Copyright Β© 2017-2024 Cloud Posse, LLC
<a href="https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-eks-cluster&utm_content=readme_footer_link"><img alt="README footer" src="https://cloudposse.com/readme/footer/img"/></a>
<img alt="Beacon" width="0" src="https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-eks-cluster?pixel&cs=github&cm=readme&an=terraform-aws-eks-cluster"/>