Skip to content

Commit

Permalink
adjust workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Oloruntobi Olurombi committed Aug 29, 2024
1 parent 67c9ed9 commit 3fc044e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/eks-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
- name: Apply Terraform
run: terraform apply -auto-approve

- name: Verify EC2 Instance State
run: |
aws ec2 describe-instances --instance-ids $(terraform output -raw ec2_instance_id) --query 'Reservations[*].Instances[*].State.Name' --output text
- name: Ensure EC2 Public IP is Not Empty
if: ${{ env.EC2_PUBLIC_IP == '' }}
run: |
Expand All @@ -66,6 +62,15 @@ jobs:
echo "EC2_PUBLIC_IP=$EC2_PUBLIC_IP" >> $GITHUB_ENV
echo "Captured EC2 Public IP: $EC2_PUBLIC_IP"
- name: Verify EC2 Instance State
run: |
INSTANCE_STATE=$(aws ec2 describe-instances --instance-ids $(terraform output -raw ec2_instance_id) --query 'Reservations[*].Instances[*].State.Name' --output text)
echo "EC2 Instance State: $INSTANCE_STATE"
if [[ "$INSTANCE_STATE" != "running" ]]; then
echo "Error: EC2 instance is not running."
exit 1
fi
InstallTools:
runs-on: ubuntu-latest
needs: TerraformApply
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ output "ec2_public_ip" {
value = aws_instance.control_plane.public_ip
}

output "ec2_instance_id" {
value = aws_instance.control_plane.id
}

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

0 comments on commit 3fc044e

Please sign in to comment.