eks-basic¶
Example that combines the vpc and eks modules:
- A
10.0.0.0/16VPC across 2 availability zones with a single shared NAT gateway. - An EKS cluster and managed node group placed in the VPC's private subnets.
- Add-ons disabled (
enable_ingress_nginx,enable_cluster_autoscaler,enable_cert_manager=false). See the comment inmain.tffor how to enable them and from where Terraform has to run to reach the (private by default) API endpoint. aws,helmandkubernetesproviders configured withexec+aws eks get-token. TheawsCLI must be installed and authenticated where Terraform runs.
Approximate cost¶
Roughly 0.25 USD/hour (us-east-1, on-demand, indicative only): EKS control plane ~0.10, NAT gateway
~0.045 plus data processing, 2 x t3.medium nodes ~0.083, plus EBS, KMS and CloudWatch Logs.
Check current AWS pricing before applying.
Usage¶
Requires AWS credentials for the target account in your environment.
terraform init
terraform apply
Destroy¶
terraform destroy
Destroy with the same -var flags you applied with. If you enabled add-ons, destroy them from a host that
can reach the API endpoint, and make sure no Kubernetes LoadBalancer services or ingresses remain, because
their load balancers and ENIs can block VPC deletion.
Requirements¶
| Name | Version |
|---|---|
| terraform | >= 1.6.0 |
| aws | >= 5.0 |
| helm | >= 3.0, < 4.0 |
| kubernetes | >= 2.25, < 4.0 |
Providers¶
No providers.
Modules¶
| Name | Source | Version |
|---|---|---|
| eks | ../../modules/eks | n/a |
| vpc | ../../modules/vpc | n/a |
Resources¶
No resources.
Inputs¶
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| azs | Exactly two availability zones in region to spread the subnets across. |
list(string) |
[ |
no |
| cluster_name | Name of the EKS cluster (also used to name the VPC). | string |
"eks-basic" |
no |
| region | AWS region to deploy the example into. | string |
"us-east-1" |
no |
Outputs¶
| Name | Description |
|---|---|
| cluster_endpoint | Endpoint of the Kubernetes API server. |
| cluster_name | Name of the EKS cluster. |
| vpc_id | ID of the VPC created by the example. |