35 lines
1.2 KiB
Bash
Executable file
35 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
echo "=========================================="
|
|
echo " Bootstrapping Control Center VM "
|
|
echo "=========================================="
|
|
|
|
# Ensure script is run with appropriate permissions (this script might run as part of Cloud-Init or manually)
|
|
|
|
if ! command -v terraform &> /dev/null; then
|
|
echo "Terraform not found. Please ensure it is installed via Nix."
|
|
exit 1
|
|
fi
|
|
|
|
echo "1. Initializing proxmox-bootstrap state..."
|
|
cd terraform/proxmox-bootstrap
|
|
terraform init
|
|
|
|
echo "2. Applying proxmox-bootstrap (Requires manual approval if not passing -auto-approve)"
|
|
echo " This will configure the restricted terraform@pve user on the Proxmox host."
|
|
# Uncomment the following line to auto-approve in a fully automated environment
|
|
# terraform apply -auto-approve
|
|
terraform apply
|
|
|
|
echo "3. Fetching the generated API token..."
|
|
TF_TOKEN=$(terraform output -raw terraform_api_token)
|
|
|
|
echo "=========================================="
|
|
echo " IMPORTANT: Save the following token into "
|
|
echo " Forgejo Secrets as PROXMOX_TOKEN_SECRET "
|
|
echo "=========================================="
|
|
echo "$TF_TOKEN"
|
|
echo "=========================================="
|
|
|
|
echo "Control Center Bootstrap Complete."
|