aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function/terraform.sh
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash/function/terraform.sh')
-rw-r--r--resources/libraries/bash/function/terraform.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/resources/libraries/bash/function/terraform.sh b/resources/libraries/bash/function/terraform.sh
index e47f38937c..9d13a55990 100644
--- a/resources/libraries/bash/function/terraform.sh
+++ b/resources/libraries/bash/function/terraform.sh
@@ -101,13 +101,23 @@ function terraform_install () {
# Install terraform.
- terraform_version="1.4.2/terraform_1.4.2_linux_arm64.zip"
+ OS_ARCH=$(uname -m) || die "Failed to get arch."
+ case "${OS_ARCH}" in
+ x86_64) architecture="amd64" ;;
+ aarch64) architecture="arm64" ;;
+ esac
+
+ terraform_version="1.4.2/terraform_1.4.2_linux_${architecture}.zip"
terraform_url="https://releases.hashicorp.com/terraform"
terraform_link="${terraform_url}/${terraform_version}"
wget "${terraform_link}" || die "Failed to install Terraform!"
- unzip "terraform_1.4.2_linux_arm64.zip" || die "Failed to install Terraform!"
+ unzip "terraform_1.4.2_linux_${architecture}.zip" || {
+ die "Failed to install Terraform!"
+ }
mv "terraform" "/usr/local/bin" || die "Failed to install Terraform!"
- rm "terraform_1.4.2_linux_arm64.zip" || die "Failed to install Terraform!"
+ rm "terraform_1.4.2_linux_${architecture}.zip" || {
+ die "Failed to install Terraform!"
+ }
}