Running an EKS with Terraform >= .12
Please refer official EKS documentation for more information about EKS.
NOTE: For a small cluster it will take anywhere from 10-15 minutes to complete initial creation.
Please refer to official Terrform EKS docs for more information about the Terraform code.
Example:
module "eks" {
source = "geekbass/eks/aws"
version = "~> 0.0.1"
cluster_name = "my-eks-001"
kubernetes_version = "1.19"
# Workers
node_groups = {
label-studio = {
name = "label-studio"
desired_number_workers = 2
max_number_workers = 2
min_number_workers = 2
instance_types = ["t2.medium"]
ami_type = "AL2_x86_64"
disk_size = 50
k8s_labels = {
environment = "test"
app = "label-studio"
owner = "datascience"
}
},
ops = {
name = "ops"
desired_number_workers = 2
max_number_workers = 2
min_number_workers = 2
instance_types = ["t2.medium"]
ami_type = "AL2_x86_64"
disk_size = 50
k8s_labels = {
environment = "test"
app = "ops"
owner = "datascience"
}
}
}
}
Prerequisites
Requirements
No requirements.
Providers
Name | Version |
---|---|
aws | n/a |
random | n/a |
Modules
No modules.
Resources
Name | Type |
---|---|
aws_eks_cluster.eks | resource |
aws_eks_node_group.eks | resource |
aws_iam_role.eks-cluster | resource |
aws_iam_role.eks-node | resource |
aws_iam_role_policy_attachment.eks-cluster-AmazonEKSClusterPolicy | resource |
aws_iam_role_policy_attachment.eks-cluster-AmazonEKSServicePolicy | resource |
aws_iam_role_policy_attachment.eks-cluster-AmazonEKSVPCResourceController | resource |
aws_iam_role_policy_attachment.eks-node-AmazonEC2ContainerRegistryReadOnly | resource |
aws_iam_role_policy_attachment.eks-node-AmazonEKSWorkerNodePolicy | resource |
aws_iam_role_policy_attachment.eks-node-AmazonEKS_CNI_Policy | resource |
aws_internet_gateway.eks | resource |
aws_route.internet_access | resource |
aws_route_table_association.eks | resource |
aws_subnet.eks | resource |
aws_vpc.eks | resource |
random_id.id | resource |
aws_availability_zones.available | data source |
aws_eks_cluster.eks | data source |
aws_eks_cluster_auth.eks | data source |
aws_region.current | data source |
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
admin_ips | List of IPs that can access API. | list(any) |
[ |
no |
ami_type | Desired AMI Type to Use. | string |
"AL2_x86_64" |
no |
availability_zones | List of AZs. | list(string) |
[] |
no |
aws_profile | Current AWS profile to use in Kubeconfig | string |
"" |
no |
cluster_name | The name of your EKS Cluster. | string |
"my-eks" |
no |
cluster_name_random_string | Add a random string to the cluster name | bool |
false |
no |
desired_number_workers | Desired Number of Worker Nodes. | number |
1 |
no |
disk_size | Disk Size for Worker Nodes. | number |
20 |
no |
force_update_version | Whether to force an Upgrade if Pods are unable to be drained. | bool |
false |
no |
instance_types | Desired Instance Types for Worker Nodes. | string |
"t3.medium" |
no |
kubernetes_version | Desired Kuberenetes Version for the Cluster. This is used for Both Control Plane and Workers. | string |
"1.17" |
no |
max_number_workers | Maximum Number of Worker Nodes. | number |
1 |
no |
min_number_workers | Minimum Number of Worker Nodes. | number |
1 |
no |
node_group_name | Node Group Name | string |
"eks" |
no |
node_groups | Map of maps of eks node groups to create. | any |
{ |
no |
tags | A map of tags to add to all resources. | map(string) |
{} |
no |
Outputs
Name | Description |
---|---|
aws_kubeconfig | kubeconfig to use with AWS Auth |
config_map_aws_auth | n/a |
eks_cluster_arn | The Amazon Resource Name (ARN) of the cluster |
eks_cluster_id | The name of the cluster |
eks_node_groups | n/a |
kubeconfig | Default kubeconfig for kubectl |