Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin AWSCLI version and update dependency checks #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions terraform-selfhost/deploy-selfhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ if [[ ! -f $(which aws) ]]; then
echo "Error: Must have AWSCLI installed.";
fi

if [[ $(aws --version | grep "aws-cli/2" | wc -l) -lt 1 ]]; then
if [[ $(aws --version | grep -c "aws-cli/2") != 1 ]]; then
ERR=1;
echo "Error: NPK Selfhost requires AWSCLI version 2.";
echo "Error: Wrong version of Terraform is installed. NPK requires AWSCLI version 2.";
fi

if [[ ! -f $(which npm) ]]; then
Expand All @@ -37,7 +37,7 @@ if [[ ! -f $(which terraform) ]]; then
echo "Error: Must have Terraform installed.";
fi

if [[ "$(terraform -v | grep v0.11 | wc -l)" != "1" ]]; then
if [[ $($TERBIN -v | grep -c "Terraform v0.11") != 1 ]]; then
ERR=1;
echo "Error: Wrong version of Terraform is installed. NPK requires Terraform v0.11.";
echo "-> Note: A non-default binary can be specified as a positional script parameter:"
Expand Down
12 changes: 8 additions & 4 deletions terraform/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if [[ ! -f $(which aws) ]]; then
echo "Error: Must have AWSCLI installed.";
fi

if [[ $(aws --version | grep -c "aws-cli/2") != 1 ]]; then
ERR=1;
echo "Error: Wrong version of Terraform is installed. NPK requires AWSCLI version 2.";
fi

if [[ ! -f $(which npm) ]]; then
ERR=1;
echo "Error: Must have NPM installed.";
Expand All @@ -32,10 +37,10 @@ if [[ ! -f $(which terraform) ]]; then
echo "Error: Must have Terraform installed.";
fi

if [[ "$($TERBIN -v | grep v0.11 | wc -l)" != "1" ]]; then
if [[ $($TERBIN -v | grep -c "Terraform v0.11") != 1 ]]; then
ERR=1;
echo "Error: Wrong version of Terraform is installed. NPK requires Terraform v0.11.";
echo "-> Note: A non-default binary can be specified as positional script parameter:"
echo "-> Note: A non-default binary can be specified as a positional script parameter:"
echo "-> e.g: ./deploy-selfhost.sh <terraform-v0.11-path>"
echo ""
fi
Expand Down Expand Up @@ -213,7 +218,6 @@ fi
# remove old configs silently:
rm -f *.tf.json


echo "[*] Generating Terraform configurations"
jsonnet -m . terraform.jsonnet

Expand All @@ -236,4 +240,4 @@ if [[ ! -d .terraform || $ISINIT -ne 0 ]]; then
fi
fi

terraform apply -auto-approve
$TERBIN apply -auto-approve