|
72 | 72 | run: | |
73 | 73 | terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf.plan |
74 | 74 | terraform show -no-color tf.plan > tfplan.txt |
75 | | - echo "summary=$(grep -E 'Plan: [0-9]+ to add, [0-9]+ to change, [0-9]+ to destroy\.|No changes\. Your infrastructure matches the configuration\.' tfplan.txt | sed 's/.*No changes\. Your infrastructure matches the configuration/Plan: no changes/g' | sed 's/.*Plan: //g' | sed 's/\..*//g')" >> $GITHUB_OUTPUT |
76 | | - working-directory: ./infrastructure |
77 | | - shell: bash |
78 | | - |
79 | | - - name: Truncate Plan Output |
80 | | - id: plan-truncated |
81 | | - if: success() || failure() |
82 | | - env: |
83 | | - LENGTH: 64512 |
84 | | - run: | |
85 | | - PLAN_FULL=$(grep -v 'Refreshing state...' <<'EOF' |
86 | | - ${{ steps.plan.outputs.stdout }} |
87 | | - ${{ steps.plan.outputs.stderr }} |
88 | | - EOF |
89 | | - ) |
90 | 75 |
|
91 | 76 | # Mask AWS account IDs (12-digit numbers) |
92 | 77 | echo "$PLAN_FULL" | grep -oE '[0-9]{12}' | while read -r account_id; do |
@@ -115,6 +100,22 @@ jobs: |
115 | 100 | # Mask Terraform variables |
116 | 101 | echo "::add-mask::${{ vars.TF_VARS_FILE }}" |
117 | 102 |
|
| 103 | + echo "summary=$(grep -E 'Plan: [0-9]+ to add, [0-9]+ to change, [0-9]+ to destroy\.|No changes\. Your infrastructure matches the configuration\.' tfplan.txt | sed 's/.*No changes\. Your infrastructure matches the configuration/Plan: no changes/g' | sed 's/.*Plan: //g' | sed 's/\..*//g')" >> $GITHUB_OUTPUT |
| 104 | + working-directory: ./infrastructure |
| 105 | + shell: bash |
| 106 | + |
| 107 | + - name: Truncate Plan Output |
| 108 | + id: plan-truncated |
| 109 | + if: success() || failure() |
| 110 | + env: |
| 111 | + LENGTH: 64512 |
| 112 | + run: | |
| 113 | + PLAN_FULL=$(grep -v 'Refreshing state...' <<'EOF' |
| 114 | + ${{ steps.plan.outputs.stdout }} |
| 115 | + ${{ steps.plan.outputs.stderr }} |
| 116 | + EOF |
| 117 | + ) |
| 118 | +
|
118 | 119 | # Optionally redact sensitive strings in the PLAN_FULL variable |
119 | 120 | PLAN_FULL=$(echo "$PLAN_FULL" | sed -E 's/[0-9]{12}/[REDACTED_AWS_ACCOUNT_ID]/g') |
120 | 121 | PLAN_FULL=$(echo "$PLAN_FULL" | sed -E 's#https://[a-zA-Z0-9.-]+\.lambda\.amazonaws\.com/[a-zA-Z0-9/._-]+#[REDACTED_LAMBDA_URL]#g') |
|
0 commit comments