44
44
45
45
# ✅ Install Terraform
46
46
- name : Setup Terraform
47
- uses : hashicorp/setup-terraform@v2
48
- with :
49
- terraform_version : 1.6.6
47
+ uses : hashicorp/setup-terraform@v3
50
48
51
49
# ✅ Terraform Init & Workspace
52
50
- name : Terraform Init & Workspace
@@ -63,17 +61,17 @@ jobs:
63
61
-var "stage=${{ github.event.inputs.stage }}"
64
62
65
63
# ✅ Get EC2 IPs & S3 Bucket
66
- - name : Get EC2 Public IP & S3 Bucket Name
67
- working-directory : ${{ env.TF_WORKING_DIR }}
64
+ - name : Get EC2s Public IPs & S3 Bucket Name
68
65
run : |
69
- APP_IP =$(terraform output -raw instance_public_ip | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n1)
70
- VERIFIER_IP=$(terraform output -raw verifier_instance_public_ip | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n1)
71
- S3_BUCKET=$(terraform output -raw s3_log_bucket | grep -oE 'techeazy-logs-[^[:space:]]+' | head -n1)
66
+ echo "INSTANCE_IP =$(terraform output -raw instance_public_ip)" >> $GITHUB_ENV
67
+ echo " VERIFIER_IP=$(terraform output -raw verifier_instance_public_ip)" >> $GITHUB_ENV
68
+ echo " S3_BUCKET=$(terraform output -raw s3_log_bucket)" >> $GITHUB_ENV
72
69
73
- echo "📦 App IP: $APP_IP "
70
+ echo "📦 App IP: $INSTANCE_IP "
74
71
echo "🔑 Verifier IP: $VERIFIER_IP"
75
72
echo "🪣 S3 Bucket: $S3_BUCKET"
76
73
74
+
77
75
# ✅ Wait for App Initialization
78
76
- name : Wait for App Initialization
79
77
run : |
83
81
# ✅ Validate App Health
84
82
- name : Validate App Health
85
83
run : |
86
- echo "🌐 Checking app health at http://$APP_IP :80"
84
+ echo "🌐 Checking app health at http://$INSTANCE_IP :80"
87
85
for i in {1..10}; do
88
- STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://$APP_IP :80)
86
+ STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://$INSTANCE_IP :80)
89
87
if [[ "$STATUS" == "200" ]]; then
90
88
echo "✅ App is healthy (HTTP 200)"
91
89
exit 0
0 commit comments