Initial commit.
This commit is contained in:
commit
38c0b98fa8
8 changed files with 199 additions and 0 deletions
40
bin/tofu-k3d-install.sh
Executable file
40
bin/tofu-k3d-install.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# VARIABLES
|
||||
# Default token for the argocd cluster
|
||||
K3D_CLUSTER_TOKEN="argocdToken"
|
||||
# Relative PATH to install the k3d cluster using terr-iaform
|
||||
K3D_TF_RELPATH="k3d-tf"
|
||||
# Secrets yaml file
|
||||
SECRETS_YAML="secrets.yaml"
|
||||
# Relative PATH to the workdir from the script directory
|
||||
WORK_DIR_RELPATH=".."
|
||||
|
||||
# Compute WORKDIR
|
||||
SCRIPT="$(readlink -f "$0")"
|
||||
SCRIPT_DIR="$(dirname "$SCRIPT")"
|
||||
WORK_DIR="$(readlink -f "$SCRIPT_DIR/$WORK_DIR_RELPATH")"
|
||||
|
||||
# Update the PATH to add the arkade bin directory
|
||||
# Add the arkade binary directory to the path if missing
|
||||
case ":${PATH}:" in
|
||||
*:"${HOME}/.arkade/bin":*) ;;
|
||||
*) export PATH="${PATH}:${HOME}/.arkade/bin" ;;
|
||||
esac
|
||||
|
||||
# Go to the k3d-tf dir
|
||||
cd "$WORK_DIR/$K3D_TF_RELPATH" || exit 1
|
||||
|
||||
# Create secrets.yaml file and encode it with sops if missing
|
||||
if [ ! -f "$SECRETS_YAML" ]; then
|
||||
echo "token: $K3D_CLUSTER_TOKEN" >"$SECRETS_YAML"
|
||||
sops encrypt -i "$SECRETS_YAML"
|
||||
fi
|
||||
|
||||
# Initialize terraform
|
||||
tofu init
|
||||
|
||||
# Apply the configuration
|
||||
tofu apply
|
Loading…
Add table
Add a link
Reference in a new issue