Skip to content

Instantly share code, notes, and snippets.

@lulichn
Last active February 27, 2024 02:40
Show Gist options
  • Save lulichn/34647d185311cea5284291e8d3f10762 to your computer and use it in GitHub Desktop.
Save lulichn/34647d185311cea5284291e8d3f10762 to your computer and use it in GitHub Desktop.
provision.sh
#!/bin/bash
set -e
TERRAFORM_VERSION=1.7.4
ECSPRESSO_VERSION=2.3.2
get_arch() {
local arch=$(uname -m)
if [ "$arch" = "x86_64" ]; then
echo "amd64"
elif [ "$arch" = "aarch64" ]; then
echo "arm64"
else
echo "Unsupported architecture: $arch" >&2
exit 1
fi
}
current_dir=$(pwd)
temp_dir=$(mktemp -d)
if [ ! -d "$temp_dir" ]; then
echo "Failed to create temp directory"
exit 1
fi
cd "$temp_dir"
arch=$(get_arch)
# Terraform
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${arch}.zip
unzip terraform_${TERRAFORM_VERSION}_linux_${arch}.zip
# ecspresso
wget https://github.com/kayac/ecspresso/releases/download/v${ECSPRESSO_VERSION}/ecspresso_${ECSPRESSO_VERSION}_linux_${arch}.tar.gz
tar xvfz ecspresso_${ECSPRESSO_VERSION}_linux_${arch}.tar.gz
# binディレクトリがなければ作成
if [ ! -d ~/bin ]; then
mkdir ~/bin
fi
# 移動
mv terraform ~/bin
mv ecspresso ~/bin
cd "$current_dir"
rm -rf "$temp_dir"
~/bin/terraform -v
~/bin/ecspresso version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment