You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/terraform-dev-to-main-ci.yml
+2-16Lines changed: 2 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -73,17 +73,12 @@ jobs:
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
75
76
-
77
-
echo "0"
78
-
79
76
# Mask sensitive URLs in the Terraform Plan output
80
77
grep -Eo 'https://[a-zA-Z0-9.-]+\.execute-api\.[a-zA-Z0-9.-]+\.amazonaws\.com/[a-zA-Z0-9/._-]*' tfplan.txt | while read -r api_url; do
81
78
if [ -n "$api_url" ]; then
82
79
echo "::add-mask::$api_url"
83
80
fi
84
-
done
85
-
86
-
echo "1"
81
+
done || echo "No api URLs found to mask."
87
82
88
83
# Mask Lambda invocation URLs
89
84
grep -Eo 'https://[a-zA-Z0-9.-]+\.lambda\.amazonaws\.com/[a-zA-Z0-9/._-]+' tfplan.txt | while read -r lambda_url; do
@@ -92,29 +87,20 @@ jobs:
92
87
fi
93
88
done || echo "No Lambda URLs found to mask."
94
89
95
-
echo "2"
96
-
97
90
# Mask AWS account IDs (12-digit numbers)
98
91
grep -Eo '[0-9]{12}' tfplan.txt | while read -r account_id; do
99
92
if [ -n "$account_id" ]; then
100
93
echo "::add-mask::$account_id"
101
94
fi
102
-
done
103
-
104
-
echo "3"
95
+
done || echo "No Account IDs found to mask."
105
96
106
97
# Mask GitHub secrets
107
98
echo "::add-mask::${{ secrets.AWS_ASSUME_ROLE }}"
108
99
echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"
109
100
110
-
echo "4"
111
-
112
-
113
101
# Mask Terraform variables
114
102
echo "::add-mask::${{ vars.TF_VARS_FILE }}"
115
103
116
-
echo "5"
117
-
118
104
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
0 commit comments