Add Google Cloud K3s infrastructure support
- Add Terraform configuration for GCP instance and storage - Add startup script for K3s installation and configuration - Add pipeline scripts for deployment and management - Add Forgejo deployment manifests and configuration
This commit is contained in:
parent
7384722305
commit
2ab7872af1
30 changed files with 1024 additions and 324 deletions
29
gcloud/tf/scripts/run_tofu.sh
Executable file
29
gcloud/tf/scripts/run_tofu.sh
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Get the directory where the script is located
|
||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
cd "$SCRIPT_DIR" || { echo "Failed to change directory to $SCRIPT_DIR"; exit 1; }
|
||||
TF_DIR="../"
|
||||
|
||||
cd "$TF_DIR" || { echo "Failed to change directory to $TF_DIR"; exit 1; }
|
||||
|
||||
if [[ -d ".terraform" && -f ".terraform.lock.hcl" ]]; then
|
||||
echo "✅ Terraform already initialized"
|
||||
# tofu init
|
||||
else
|
||||
echo "⚠️ Initializing Terraform..."
|
||||
tofu init
|
||||
fi
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "❌ tofu init failed, please check the output above"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# tofu apply with auto-approve to make it non-interactive
|
||||
tofu apply -auto-approve
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "❌ tofu apply failed, please check the output above"
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue