Update Terraform workflow file paths and output handling
All checks were successful
Terraform Deploy / Validate (push) Successful in 5s
Terraform Deploy / Plan (push) Successful in 5s
Terraform Deploy / Apply (push) Successful in 1m39s

- Change single quotes to double quotes in path filters for consistency
- Modify command redirection to use > instead of | tee for cleaner
  output handling
- Add explicit cat command to display plan output in logs
- Standardize whitespace formatting throughout files
This commit is contained in:
Damien
2026-05-03 21:07:27 +02:00
parent 1ff49e1a2e
commit 96394ab1b1
2 changed files with 15 additions and 13 deletions

View File

@@ -5,8 +5,8 @@ on:
branches:
- dev
paths:
- 'terraform/**'
- '.gitea/workflows/terraform-*.yml'
- "terraform/**"
- ".gitea/workflows/terraform-*.yml"
env:
TF_WORKING_DIR: terraform/prod
@@ -89,16 +89,17 @@ jobs:
id: plan
run: |
set +e
terraform plan -input=false -no-color -detailed-exitcode -out=tfplan 2>&1 | tee plan_output.txt
terraform plan -input=false -no-color -detailed-exitcode -out=tfplan > plan_output.txt 2>&1
EXITCODE=$?
cat plan_output.txt
# Determine if there are changes
if [ $EXITCODE -eq 2 ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
# Exit 1 is error, 0 and 2 are OK
if [ $EXITCODE -eq 1 ]; then
exit 1

View File

@@ -5,8 +5,8 @@ on:
branches:
- dev
paths:
- 'terraform/**'
- '.gitea/workflows/terraform-*.yml'
- "terraform/**"
- ".gitea/workflows/terraform-*.yml"
env:
TF_WORKING_DIR: terraform/prod
@@ -87,8 +87,9 @@ jobs:
id: plan
run: |
set +e
terraform plan -input=false -no-color -detailed-exitcode -out=tfplan 2>&1 | tee plan_output.txt
terraform plan -input=false -no-color -detailed-exitcode -out=tfplan > plan_output.txt 2>&1
EXITCODE=$?
cat plan_output.txt
echo "exitcode=${EXITCODE}" >> $GITHUB_OUTPUT
if [ $EXITCODE -eq 1 ]; then
exit 1
@@ -116,22 +117,22 @@ jobs:
PLAN_OUTPUT=$(cat plan_output.txt | head -c 60000)
COMMENT_BODY=$(cat <<EOF
## 🔍 Terraform Plan
**Exit code:** \`${{ steps.plan.outputs.exitcode }}\`
- \`0\` = No changes
- \`2\` = Changes detected
<details>
<summary>Click to expand plan output</summary>
\`\`\`hcl
${PLAN_OUTPUT}
\`\`\`
</details>
EOF
)
curl -s -X POST \
-H "Authorization: token ${GIT_TOKEN}" \
-H "Content-Type: application/json" \