{"id":21726486,"url":"https://github.com/notharshhaa/eks-cluster-terraform","last_synced_at":"2025-03-20T22:55:27.150Z","repository":{"id":142894504,"uuid":"612648385","full_name":"NotHarshhaa/eks-cluster-terraform","owner":"NotHarshhaa","description":"𝐓𝐞𝐫𝐫𝐚𝐟𝐨𝐫𝐦: 𝐃𝐞𝐩𝐥𝐨𝐲 𝐚𝐧 𝐄𝐊𝐒 𝐂𝐥𝐮𝐬𝐭𝐞𝐫 — 𝐋𝐢𝐤𝐞 𝐚 𝐁𝐨𝐬𝐬!","archived":false,"fork":false,"pushed_at":"2023-03-11T15:26:11.000Z","size":10,"stargazers_count":54,"open_issues_count":0,"forks_count":51,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T19:31:22.893Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NotHarshhaa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-11T15:18:17.000Z","updated_at":"2024-11-03T15:54:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"ff898f89-436f-4e20-b968-86186fa732d9","html_url":"https://github.com/NotHarshhaa/eks-cluster-terraform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotHarshhaa%2Feks-cluster-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotHarshhaa%2Feks-cluster-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotHarshhaa%2Feks-cluster-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotHarshhaa%2Feks-cluster-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NotHarshhaa","download_url":"https://codeload.github.com/NotHarshhaa/eks-cluster-terraform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244706529,"owners_count":20496571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T03:36:10.055Z","updated_at":"2025-03-20T22:55:27.145Z","avatar_url":"https://github.com/NotHarshhaa.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 𝐓𝐞𝐫𝐫𝐚𝐟𝐨𝐫𝐦:  𝐃𝐞𝐩𝐥𝐨𝐲 𝐚𝐧 𝐄𝐊𝐒 𝐂𝐥𝐮𝐬𝐭𝐞𝐫 — 𝐋𝐢𝐤𝐞 𝐚 𝐁𝐨𝐬𝐬!\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://imgur.com/7iDEQQH.png\" /\u003e\n\u003c/p\u003e\n\n------\n###  :loudspeaker: ᴛᴇʀʀᴀғᴏʀᴍ: ᴀʙᴏᴜᴛ ᴛʜɪs ᴘʀᴏᴊᴇᴄᴛ ᴍᴏᴅᴜʟᴇs \n\n*Kubernetes, often abbreviated as “K8s” (because there are 8 letters between the “K” \u0026 “s” in Kubernetes), orchestrates containerized applications to run on a cluster of hosts. K8s also allocates storage and persistent volumes to running containers, provides automatic scaling, and works continuously to maintain the desired state of applications, providing resiliency.*\n\n*Terraform is an extremely popular infrastructure provisioning tool among DevOps. EKS is managed K8S solution provided by AWS, which is widely used managed K8S platform by AWS consumers.*\n\n*Separately, Kubernetes and Terraform are powerful and popular tools for DevOps operations. However, when you decide to use them together, you will see even more benefits for container cluster management!*\n\n-----\n## :loudspeaker: ᴛᴇʀʀᴀғᴏʀᴍ: ᴡʜʏ ᴅᴇᴘʟᴏʏ ᴡɪᴛʜ ᴛᴇʀʀᴀғᴏʀᴍ?\n\n*While you could use the built-in AWS provisioning (UI, CLI, CloudFormation) for EKS clusters, Terraform provides you with several benefits:*\n\n* *Terraform can be used to manage Kubernetes infrastructure, helping you to orchestrate your applications and run them at scale. This alleviates some of the challenges of running Kubernetes, including detecting configuration drift — planned \u0026 unplanned changes.*\n\n* *Terraform will create resources, it will also update \u0026 delete tracked resources without requiring inspection of the API.*\n\n* *Terraform understands dependency relationships between resources. For example, if an AWS Kubernetes cluster needs a specific VPC and subnet configurations, Terraform won’t attempt to create the cluster if the VPC and subnet failed to create with the proper configuration.*\n\n------\n## :loudspeaker: ᴛᴇʀʀᴀғᴏʀᴍ: ᴘʀᴇʀᴇǫᴜɪsɪᴛᴇs\n\n*For this tutorial, you will need:*\n\n* **AWS account**\n\n* **Terraform \u0026 Kubernetes installed on your IDE (I will be using VSCode)**\n\n* **AWS CLI installed and configured on your IDE**\n\n------\n## :loudspeaker: ᴛᴇʀʀᴀғᴏʀᴍ: ᴏᴜʀ ᴏʙᴊᴇᴄᴛɪᴠᴇ:\n\n1. *Create an EKS cluster (capacity of 2).*\n\n2. *Create a random string that allows 5 characters to build the cluster name.*\n\n3. *They want to output the cluster name and the ip address of the containers in the cluster.*\n\n*Lastly, all code should be in module blocks, not resource blocks.*\n\n***Let’s get started — buckle up Chuck!!***\n\n------\n\n### 𝟷| sᴇᴛ ᴜᴘ ғɪʟᴇ sʏsᴛᴇᴍ\n\n*First, clone my GitHub repository:*\n\n```\ngit clone https://github.com/harshhaareddy/eks-cluster-terraform\n```\n\n*Change into the directory to the folder shown below:*\n```\ncd eks-cluster-terraform\n```\n\n------\n### 𝟸| ᴛᴇʀʀᴀғᴏʀᴍ ɪɴɪᴛ, ᴘʟᴀɴ \u0026 ᴀᴘᴘʟʏ\n\n*After you have created the above files, the first step is to initialize the terraform backend by using the `terraform init` command. Next, you will run the `terraform plan` command to evaluate the Terraform configuration. Finally, you will run the command `terraform apply` to apply the configuration.*\n\n*Also, run the following command to to retrieve the access credentials for your cluster and configure kubectl:*\n```\naws eks update-kubeconfig --name \u003cEKS_CLUSTER_NAME\u003e --region \u003cREGION\u003e\n```\n\n*Run kubectl commands to manage your cluster and deploy Kubernetes configurations to it.*\n\n------\n### 𝟹| ᴛᴇʀʀᴀғᴏʀᴍ ᴄʟᴏᴜᴅ\n\n*Navigate to the Terraform Cloud platform, choose your organization and create a new workspace.*\n\n![https://www.terraform.io/](https://img.shields.io/badge/Terraform-3EAAAF?style=for-the-badge\u0026logo=terraform\u0026logoColor=white)\n\n*Under ***Choose your workflow***, select the version control workflow option. After you’ve selected your workflow, you’ll be directed to a different page where you will need to connect a version control provider. You will want to connect with your GitHub account and select the repo that you created in the first step.*\n\n*From there, you will create our new Workspace:*\n\n*Then you will set variables for our access keys and region. To get started, click ***Configure Variables*** followed by* ***Add variable.***\n\n*We will be inputting the below variables as ***Keys*** and then ***Value*** will be the password.*\n\n* **IMPORTANT**: *Click ***Sensitive*** for your key variables, as this will ensure your private information is not displayed.*\n\n   ⇥  **AWS_ACCESS_KEY_ID**\n   ⇥ **AWS_SECRET_ACCESS_KEY**\n   ⇥  **AWS_DEFAULT_REGION**\n   ⇥ **CONFIRM_DESTROY**\n\n------\n   ### 𝟺| ʀᴜɴ ɴᴇᴡ ᴛᴇʀʀᴀғᴏʀᴍ ᴄʟᴏᴜᴅ ᴘʟᴀɴ\n\n   *Let’s go things kicked off — click* ***Start new run*** *under the Actions tab.*\n\n   *Once you start your run, the next step will be to ***Plan \u0026 Apply***. Your plan should finish pretty quickly and once it’s finished, you’ll be prompted to click ***Confirm \u0026 Apply****.\n\n   *From here, click the Apply finished box, scroll to the bottom and you’ll see the Outputs in TF Cloud:*\n\n   *Let’s pop to the ***AWS EC2*** console and confirm that you have correctly setup your cluster. As you can see from the image below, everything looks great!*\n\n------\n   ### 𝟻| ᴛᴇʀʀᴀғᴏʀᴍ ᴅᴇsᴛʀᴏʏ\n\n   *Let’s destroy our infrastructure! Yay! Navigate back to the Terraform Cloud platform, and under settings click ***Destruction and Deletion***. Click Queue destroy plan and select ***Confirm \u0026 Apply***.*\n\n------\n   ## ***You’ve just deployed an EKS Cluster using Terraform Cloud CI/CD!***\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://imgur.com/7iMQJlY.gif\" /\u003e\n\u003c/p\u003e\n\n------\n## :biohazard: ᴄʀᴇᴅɪᴛs \u0026 ᴍᴏʀᴇ ᴀʙᴏᴜᴛ ʟɪᴋᴇ ᴛʜɪs ᴏʀ ғᴏʟʟᴏᴡ\n\nⒸ [Harshhaa Dev Projects](https://github.com/Harshhaa-Dev-Projects.git) - Made with :yellow_heart: from [Harshhaa Vardhan Reddy](https://github.com/NotHarshhaa.git)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotharshhaa%2Feks-cluster-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotharshhaa%2Feks-cluster-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotharshhaa%2Feks-cluster-terraform/lists"}