Skip to content

Commit

Permalink
install tools and packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Oloruntobi Olurombi committed Aug 27, 2024
1 parent 9018632 commit 7a44a4e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .github/workflows/eks-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,33 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}


- name: Get EC2 Public IP
id: get_public_ip
run: echo "EC2_PUBLIC_IP=$(terraform output -raw ec2_public_ip)"

InstallTools:
runs-on: ubuntu-latest
needs: TerraformApply
steps:
- name: Install SSH Client
run: sudo apt-get update && sudo apt-get install -y sshpass

- name: SSH and Install AWS CLI and kubectl
run: |
sshpass -p "${{ secrets.EC2_SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no ec2-user@${{ env.EC2_PUBLIC_IP }} << EOF
sudo yum install -y unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
curl -O "https://s3.us-west-2.amazonaws.com/amazon-eks/1.28.11/2024-07-12/bin/linux/amd64/kubectl"
chmod +x ./kubectl
mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$HOME/bin:$PATH
kubectl version --client
aws eks update-kubeconfig --region ${{ secrets.AWS_REGION }} --name ${{ env.EKS_CLUSTER_NAME }}
EOF
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,12 @@ resource "aws_eks_node_group" "eks_node_group" {
# OutPut Resources
output "endpoint" {
value = aws_eks_cluster.eks_cluster.endpoint
}

output "ec2_public_ip" {
value = aws_instance.control_plane.public_ip
}

output "eks_cluster_name" {
value = aws_eks_cluster.eks_cluster.name
}

0 comments on commit 7a44a4e

Please sign in to comment.