Skip to content

Commit

Permalink
Create tfvars file if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed May 25, 2023
1 parent 76b774e commit bad9f36
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions sample-node-config/aws/setup/setup.sh
Expand Up @@ -4,24 +4,28 @@
# fail if something goes wrong
set -e

echo "Enter [profile]: "
profile=
while [[ $profile = "" ]]; do
read profile
done

echo "Enter [key_name]: "
key_name=
while [[ $key_name = "" ]]; do
read key_name
done

test -f terraform.tfvars ||
cat << EOF >terraform.tfvars
function setup() {
echo "Enter [profile]: "
profile=
while [[ $profile = "" ]]; do
read profile
done

echo "Enter [key_name]: "
key_name=
while [[ $key_name = "" ]]; do
read key_name
done

cat << EOF >terraform.tfvars
profile = "$profile"
key_name = "$key_name"
EOF

}

test -f terraform.tfvars || setup

test -f terraform.tfvars && setup/env.sh

test -f terraform.tfvars && setup/credentials.sh
test -f terraform.tfvars && setup/credentials.sh

0 comments on commit bad9f36

Please sign in to comment.