feat: Add gcloud pipeline scripts and enhance k3s VM startup with additional checks and installations
This commit is contained in:
parent
31af97ced8
commit
ff815fa82c
6 changed files with 138 additions and 4 deletions
22
gcloud/tf/scripts/run_tofu.sh
Executable file
22
gcloud/tf/scripts/run_tofu.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
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