-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-server.sh
More file actions
executable file
·24 lines (19 loc) · 843 Bytes
/
deploy-server.sh
File metadata and controls
executable file
·24 lines (19 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env sh
set -euo pipefail;
TERRAFORM_DIR=./terraform
if which terraform > /dev/null; then
echo "Found terraform. Applying the config stored at: ${TERRAFORM_DIR}";
else
echo "Unable to find terraform on the system path. Are you sure you have it installed?";
exit 1
fi
TERRAFORM_TFVARS_FILE=terraform.tfvars
if test -f "$TERRAFORM_TFVARS_FILE"; then
echo "$TERRAFORM_TFVARS_FILE exists. Proceeding with deployment.";
else
echo "$TERRAFORM_TFVARS_FILE does not exist. Using the terraform.tfvars.sample file for the required input variables.";
TERRAFORM_TFVARS_FILE=terraform.tfvars.sample
fi
terraform -chdir=${TERRAFORM_DIR} init;
terraform -chdir=${TERRAFORM_DIR} apply -var-file $TERRAFORM_TFVARS_FILE;
echo "Deployment complete. You may now access the server at the \"dns_name\" provided in the output."