provisioning-catalog/providers/hetzner/templates/hetzner_common_vals.j2

27 lines
682 B
Text
Raw Permalink Normal View History

#!/bin/bash
# Generated by provisioning {{ provisioning_version }} at {{ now }}
set -euo pipefail
HCLOUD_TOKEN="${HCLOUD_TOKEN}"
STATE_DIR="${STATE_DIR:-/tmp/provisioning-{{ cluster_name }}-$(date +%Y%m%d-%H%M%S)}"
export HCLOUD_TOKEN STATE_DIR
# Check prerequisites
if [ -z "$HCLOUD_TOKEN" ]; then
echo "ERROR: HCLOUD_TOKEN environment variable not set"
exit 1
fi
if ! command -v hcloud &> /dev/null; then
echo "ERROR: hcloud CLI not found. See: https://github.com/hetznercloud/cli"
exit 1
fi
echo "✓ Prerequisites: HCLOUD_TOKEN set, hcloud CLI available"
# Ensure state directory exists
mkdir -p "$STATE_DIR"
{%- if debug and debug == "yes" %}
#set -x
{%- endif %}