This repository automates the provisioning, deployment, and teardown of AWS infrastructure and Kubernetes workloads — including a Dockerized Next.js application — using GitHub Actions, Terraform, Helm, and ECR.
It follows GitOps principles to manage infrastructure and CI/CD for your Next.js app running on an Amazon EKS cluster.
- Infrastructure as Code (IaC) using Terraform
- CI/CD Workflows with GitHub Actions
- AWS EKS Cluster Management
- Container Image Build & Push to AWS ECR
- Kubernetes Deployment via Helm
- Ingress Controller setup on EKS
- Destruction Workflow for resource cleanup
- Manual Trigger Support for controlled infra teardown
- Push to
new_branchwith changes inside theterraform/directory - Manual trigger via
workflow_dispatch(for destroy)
terraform:
Initializes Terraform, plans, applies infrastructure on AWS, configures kubeconfig, and installs Ingress controller on success.destroy:
Manually triggered to:- Delete Kubernetes ingress controller
- Empty AWS ECR repository
- Destroy all Terraform-managed infrastructure
- Push to the
mainbranch
-
BuildandPush:
Builds Docker image from./app, tags it with the GitHub run number, and pushes it to AWS ECR. -
DeployToEKS:- Configures AWS credentials and kubeconfig
- Creates Docker registry secret in the EKS cluster
- Deploys the image using Helm chart from
helm/appchart
- AWS account with EKS, ECR, and S3 setup
- GitHub Secrets and Variables configured:
| Key | Description |
|---|---|
AWS_ACCESS_KEY_ID |
AWS IAM access key |
AWS_SECRET_ACCESS_KEY |
AWS IAM secret key |
REGISTRY |
AWS ECR registry URI |
| Key | Description |
|---|---|
AWS_REGION |
AWS region (e.g., us-east-1) |
EKS_CLUSTER |
EKS cluster name |
BUCKET |
Terraform backend S3 bucket name |
ECR_REPO |
AWS ECR repository name |
Triggered automatically on push to
new_branch(insideterraform/), or manually run from Actions tab.
Push to
mainto build Docker image and deploy to EKS using Helm.
Trigger the Destroy Infra on AWS job manually via GitHub Actions UI.
Oyewunmi Olaleye
Website: olaleye.com.ng