Skip to content

Commit 8c51a48

Browse files
committed
fixed wg config issue
Signed-off-by: bhumi46 <thisisbn46@gmail.com>
1 parent 7c315c6 commit 8c51a48

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

.github/workflows/terraform-destroy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,23 +235,22 @@ jobs:
235235
echo "Final file permissions: $(sudo ls -la /etc/wireguard/wg0.conf)"
236236
237237
# Verify config file is not empty and has expected content
238-
if [ ! -s /etc/wireguard/wg0.conf ]; then
238+
if ! sudo test -s /etc/wireguard/wg0.conf; then
239239
echo "❌ ERROR: WireGuard config file is empty after writing!"
240-
echo "Checking if it's a permission issue..."
241-
ls -la /etc/wireguard/
240+
echo "File size: $(sudo wc -c < /etc/wireguard/wg0.conf) bytes"
242241
exit 1
243242
fi
244243
245244
# Basic validation that it looks like a WireGuard config
246-
if ! grep -q "\[Interface\]" /etc/wireguard/wg0.conf; then
245+
if ! sudo grep -q "\[Interface\]" /etc/wireguard/wg0.conf; then
247246
echo "❌ ERROR: WireGuard config doesn't contain [Interface] section"
248247
echo "Please check that TF_WG_CONFIG contains a valid WireGuard configuration"
249-
echo "Config file size: $(wc -c < /etc/wireguard/wg0.conf) bytes"
248+
echo "Config file size: $(sudo wc -c < /etc/wireguard/wg0.conf) bytes"
250249
exit 1
251250
fi
252251
253252
echo "✅ WireGuard configuration applied successfully"
254-
echo "Config file size: $(wc -c < /etc/wireguard/wg0.conf) bytes"
253+
echo "Config file size: $(sudo wc -c < /etc/wireguard/wg0.conf) bytes"
255254
env:
256255
TF_WG_CONFIG: ${{ secrets.TF_WG_CONFIG }}
257256
if: "${{ inputs.TERRAFORM_COMPONENT != 'base-infra' }}"

.github/workflows/terraform.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,23 +197,22 @@ jobs:
197197
echo "Final file permissions: $(sudo ls -la /etc/wireguard/wg0.conf)"
198198
199199
# Verify config file is not empty and has expected content
200-
if [ ! -s /etc/wireguard/wg0.conf ]; then
200+
if ! sudo test -s /etc/wireguard/wg0.conf; then
201201
echo "❌ ERROR: WireGuard config file is empty after writing!"
202-
echo "Checking if it's a permission issue..."
203-
ls -la /etc/wireguard/
202+
echo "File size: $(sudo wc -c < /etc/wireguard/wg0.conf) bytes"
204203
exit 1
205204
fi
206205
207206
# Basic validation that it looks like a WireGuard config
208-
if ! grep -q "\[Interface\]" /etc/wireguard/wg0.conf; then
207+
if ! sudo grep -q "\[Interface\]" /etc/wireguard/wg0.conf; then
209208
echo "❌ ERROR: WireGuard config doesn't contain [Interface] section"
210209
echo "Please check that TF_WG_CONFIG contains a valid WireGuard configuration"
211-
echo "Config file size: $(wc -c < /etc/wireguard/wg0.conf) bytes"
210+
echo "Config file size: $(sudo wc -c < /etc/wireguard/wg0.conf) bytes"
212211
exit 1
213212
fi
214213
215214
echo "✅ WireGuard configuration applied successfully"
216-
echo "Config file size: $(wc -c < /etc/wireguard/wg0.conf) bytes"
215+
echo "Config file size: $(sudo wc -c < /etc/wireguard/wg0.conf) bytes"
217216
env:
218217
TF_WG_CONFIG: ${{ secrets.TF_WG_CONFIG }}
219218
if: "${{ inputs.TERRAFORM_COMPONENT != 'base-infra' }}"

0 commit comments

Comments
 (0)