Prerequisites

Clone the project (https://github.com/NileTradeX/infrastructure-as-code.git) and go to the EKS directory.

To run the Terraform project, you will need:

Installation

AWS Configuration

  1. Configure your AWS credentials using the AWS CLI with aws configure. You will need your AWS Access Key ID, Secret Access Key, and default region name.

Deployment

  1. Initialize your Terraform workspace, which will download the provider plugins for AWS:
terraform init
  1. Validate the Terraform configuration files:
terraform validate
  1. Plan your changes:
terraform plan
  1. Apply your changes:
terraform apply

Outputs

This Terraform module will output the following:

  • cluster_name: The name of the EKS cluster.
  • cluster_version: The version of the EKS cluster.
  • cluster_endpoint_public_access: Whether the EKS cluster endpoint is publicly accessible.
  • enable_cluster_creator_admin_permissions: Whether the creator of the EKS cluster has admin permissions.

Configure kubeconfig

After the EKS cluster is created, you can configure kubectl to use the new cluster by updating your kubeconfig file:

aws eks –region update-kubeconfig –name <cluster_name>

Replace <region> with your AWS region and <cluster_name> with the output cluster_name.

Destruction

To destroy the Terraform-managed infrastructure:

terraform destroy

Please note that this will destroy all the resources created by Terraform, including the EKS cluster and the VPC.