mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-28 01:01:12 +00:00
⚙️ Store terraform variables (# of nodes...) in tfvars file
Using environment variables was a mistake, because they must be set again manually each time we want to re-apply the Terraform configurations. Instead, put the variables in a tfvars file.
This commit is contained in:
@@ -27,12 +27,8 @@ fi
|
||||
}
|
||||
|
||||
PROVIDER="$1"
|
||||
export TF_VAR_location="$2"
|
||||
export TF_VAR_how_many_clusters="${3-1}"
|
||||
export TF_VAR_min_nodes_per_pool="${4-2}"
|
||||
export TF_VAR_max_nodes_per_pool="${5-4}"
|
||||
|
||||
[ "$TF_VAR_location" ] || {
|
||||
[ "$2" ] || {
|
||||
"./source/modules/$PROVIDER/list_locations.sh"
|
||||
exit 1
|
||||
}
|
||||
@@ -68,6 +64,12 @@ export DIGITALOCEAN_ACCESS_TOKEN=$(grep ^access-token ~/.config/doctl/config.yam
|
||||
cp -a source $TAG
|
||||
cd $TAG
|
||||
cp -r modules/$PROVIDER modules/PROVIDER
|
||||
cat >terraform.tfvars <<EOF
|
||||
location = "$2"
|
||||
how_many_clusters = ${3-1}
|
||||
min_nodes_per_pool = ${4-2}
|
||||
max_nodes_per_pool = ${5-4}
|
||||
EOF
|
||||
$TIME -o time.1.init terraform init
|
||||
$TIME -o time.2.stage1 terraform apply -auto-approve
|
||||
cd stage2
|
||||
|
||||
Reference in New Issue
Block a user