FIX: Terraform installation
[csit.git] / resources / libraries / bash / function / terraform.sh
index 567fc78..c076f52 100644 (file)
@@ -75,7 +75,13 @@ function terraform_init () {
     set -exuo pipefail
 
     if ! installed terraform; then
-        die "Please install terraform!"
+        curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
+        os="$(lsb_release -cs)" || die "Failed to get OS release!"
+        repo="deb [arch=amd64] https://apt.releases.hashicorp.com ${os} main"
+        sudo apt-add-repository "${repo}" || die "Failed to add repo!"
+        apt update -y
+        apt install -y terraform
+        #die "Please install terraform!"
     fi
 
     pushd "${CSIT_DIR}"/fdio.infra.terraform || die "Pushd failed!"