55
55
Specifies the remote shell for remote installation. Defaults to ssh.
56
56
57
57
--with-terraform
58
- Installs Terraform binary from https://releases.hashicorp.com/terraform/1.3.4 / source
58
+ Installs Terraform binary from https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION} / source
59
59
alongside coder.
60
60
This is great for if you are having issues with Coder installing terraform, or if you
61
61
just want it on your base system aswell.
@@ -157,7 +157,7 @@ main() {
157
157
if [ " ${TRACE-} " ]; then
158
158
set -x
159
159
fi
160
-
160
+ TERRAFORM_VERSION= " 1.3.4 "
161
161
unset \
162
162
DRY_RUN \
163
163
METHOD \
@@ -222,7 +222,7 @@ main() {
222
222
exit 0
223
223
;;
224
224
--with-terraform)
225
- METHOD=install_terraform
225
+ METHOD=with_terraform
226
226
;;
227
227
--)
228
228
shift
@@ -253,7 +253,7 @@ main() {
253
253
fi
254
254
255
255
METHOD=" ${METHOD-detect} "
256
- if [ " $METHOD " != detect ] && [ " $METHOD " != install_terraform ] && [ " $METHOD " != standalone ]; then
256
+ if [ " $METHOD " != detect ] && [ " $METHOD " != with_terraform ] && [ " $METHOD " != standalone ]; then
257
257
echoerr " Unknown install method \" $METHOD \" "
258
258
echoerr " Run with --help to see usage."
259
259
exit 1
@@ -290,9 +290,9 @@ main() {
290
290
exit 1
291
291
fi
292
292
fi
293
- if [ " $METHOD " = install_terraform ]; then
294
- # Install terraform then contine the script
295
- install_terraform
293
+ if [ " $METHOD " = with_terraform ]; then
294
+ # Install terraform then continue the script
295
+ with_terraform
296
296
fi
297
297
298
298
# DISTRO can be overridden for testing but shouldn't normally be used as it
@@ -369,20 +369,19 @@ fetch() {
369
369
sh_c mv " $FILE .incomplete" " $FILE "
370
370
}
371
371
372
- install_terraform () {
372
+ with_terraform () {
373
373
# Check if the unzip package is installed. If not error peacefully.
374
374
if ! (command_exists unzip); then
375
375
echoh
376
376
echoerr " This script needs the unzip package to run."
377
377
echoerr " Please install unzip to use this function"
378
378
exit 1
379
379
fi
380
- TERRAFORM_VERSION=" 1.3.4"
381
- echoh " Installing Terraform version $TERRAFORM_VERSION $TERRAFORM_ARCH package from Hashicorp Source."
380
+ echoh " Installing Terraform version $TERRAFORM_VERSION $TERRAFORM_ARCH from the HashiCorp release repository."
382
381
echoh
383
382
384
- # Download from offical source and save it to cache
385
- fetch " https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION} /terraform_1.3.4_ ${OS} _${TERRAFORM_ARCH} .zip" \
383
+ # Download from official source and save it to cache
384
+ fetch " https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION} /terraform_ ${TERRAFORM_VERSION} _ ${OS} _${TERRAFORM_ARCH} .zip" \
386
385
" $CACHE_DIR /terraform_${TERRAFORM_VERSION} _${OS} _${TERRAFORM_ARCH} .zip"
387
386
388
387
sh_c mkdir -p " $TERRAFORM_INSTALL_PREFIX " 2> /dev/null || true
@@ -393,7 +392,7 @@ install_terraform() {
393
392
fi
394
393
# Prepare /usr/local/bin/ and the binary for copying
395
394
" $sh_c " mkdir -p " $TERRAFORM_INSTALL_PREFIX /bin"
396
- " $sh_c " unzip -d " $CACHE_DIR " -o " $CACHE_DIR /terraform_1.3.4_ ${OS} _${ARCH} .zip"
395
+ " $sh_c " unzip -d " $CACHE_DIR " -o " $CACHE_DIR /terraform_ ${TERRAFORM_VERSION} _ ${OS} _${ARCH} .zip"
397
396
COPY_LOCATION=" $TERRAFORM_INSTALL_PREFIX /bin/terraform"
398
397
399
398
# Remove the file if it already exists to
@@ -578,8 +577,8 @@ arch() {
578
577
esac
579
578
}
580
579
581
- # The following is to change the naming, that way people with armv7 won't recieve a error
582
- # List of binaries can be found here: https://releases.hashicorp.com/terraform/1.3.4/
580
+ # The following is to change the naming, that way people with armv7 won't receive a error
581
+ # List of binaries can be found here: https://releases.hashicorp.com/terraform/
583
582
terraform_arch () {
584
583
uname_m=$( uname -m)
585
584
case $uname_m in
0 commit comments