@@ -115,6 +115,13 @@ jobs:
115115 with :
116116 name : inventory
117117 path : ansible/inventory.ini
118+ - name : Upload terraform.tfvars
119+
120+ uses : actions/upload-artifact@v4
121+ with :
122+ name : terraform-vars
123+ path : infra/terraform.tfvars
124+ retention-days : 1
118125
119126 - name : 🗃️ Run Script Configure Jumpbox
120127 run : |
@@ -201,28 +208,26 @@ jobs:
201208 run : |
202209 cd infra
203210
204- # Get outputs using raw text format (not JSON)
205- APP_NAME=$(terraform output -raw app_service_name )
206- RG_NAME=$(terraform output -raw resource_group_name )
207- API_URL=$(terraform output -raw lb_api_url )
211+ # Get outputs using separate commands with proper sanitization
212+ APP_NAME=$(terraform output app_service_name | sed 's/"//g' | tr -d '\n' )
213+ RG_NAME=$(terraform output resource_group_name | sed 's/"//g' | tr -d '\n' )
214+ API_URL=$(terraform output lb_api_url | sed 's/"//g' | tr -d '\n' )
208215
209- # Verify outputs are not empty
210- if [[ -z "$APP_NAME" || -z "$RG_NAME" || -z "$API_URL" ]]; then
211- echo "::error::Missing required Terraform outputs"
212- terraform output
216+ # Verify outputs don't contain command strings
217+ if [[ "$APP_NAME" == *"command"* || "$RG_NAME" == *"command"* || "$API_URL" == *"command"* ]]; then
218+ echo "::error::Terraform outputs contain command strings!"
219+ echo "APP_NAME: $APP_NAME"
220+ echo "RG_NAME: $RG_NAME"
221+ echo "API_URL: $API_URL"
213222 exit 1
214223 fi
215224
216- # Sanitize outputs (remove any special characters)
217- APP_NAME=$(echo "$APP_NAME" | tr -d '\n\r"')
218- RG_NAME=$(echo "$RG_NAME" | tr -d '\n\r"')
219- API_URL=$(echo "$API_URL" | tr -d '\n\r"')
220-
221- echo "webapp_name=${APP_NAME}" >> $GITHUB_OUTPUT
222- echo "resource_group=${RG_NAME}" >> $GITHUB_OUTPUT
223- echo "api_url=${API_URL}" >> $GITHUB_OUTPUT
225+ # Set outputs
226+ echo "app_service_name=${APP_NAME}" >> $GITHUB_OUTPUT
227+ echo "resource_group_name=${RG_NAME}" >> $GITHUB_OUTPUT
228+ echo "lb_api_url=${API_URL}" >> $GITHUB_OUTPUT
224229
225- echo "✅ Verified outputs:"
230+ echo "✅ Verified clean outputs:"
226231 echo "APP: ${APP_NAME}"
227232 echo "RG: ${RG_NAME}"
228233 echo "API: ${API_URL}"
0 commit comments