aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-08-14 16:56:14 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2021-08-14 16:56:14 +0200
commit80c5076e76bbe93048e9f78e120c1ee9965f6728 (patch)
tree41db0296459c910a2d59663bd2ee9ed105a777b0
parente2b6e5847fd6579ff0f6801ec6c2b997d6d098f2 (diff)
downloadinfra-80c5076e76bbe93048e9f78e120c1ee9965f6728.tar.gz
infra-80c5076e76bbe93048e9f78e120c1ee9965f6728.tar.bz2
infra-80c5076e76bbe93048e9f78e120c1ee9965f6728.tar.xz
infra-80c5076e76bbe93048e9f78e120c1ee9965f6728.zip
terraform
-rw-r--r--.settings.sh9
-rwxr-xr-xbin/terraform28
-rw-r--r--terraform/main.tf12
3 files changed, 20 insertions, 29 deletions
diff --git a/.settings.sh b/.settings.sh
index ee62748..9967ba6 100644
--- a/.settings.sh
+++ b/.settings.sh
@@ -14,10 +14,15 @@ else
source <(cd $basedir/ansible; ansible-vault view ../.vault)
fi
+export ANSIBLE_CONFIG=$basedir/ansible.cfg
+
+if [[ -x $basedir/ansible/.vault-password ]]
+then
+ export ANSIBLE_VAULT_PASS=$($basedir/ansible/.vault-password)
+fi
+
if [[ -d $basedir/bin/.mc ]]
then
echo "Loading completions for mc"
complete -C $basedir/bin/mc mc
fi
-
-alias terraform="ANSIBLE_VAULT_PASS=\$($(pwd)/ansible/.vault-password) $basedir/bin/terraform"
diff --git a/bin/terraform b/bin/terraform
index 06c2a76..249d7ae 100755
--- a/bin/terraform
+++ b/bin/terraform
@@ -1,25 +1,23 @@
#!/bin/bash
set -euo pipefail
-#set -x
-basedir="$(dirname $0)"
+basedir=$(dirname "$0")
-terraform_version=0.13.5
-terraform_url=https://releases.hashicorp.com/terraform/$terraform_version/terraform_${terraform_version}_linux_amd64.zip
+version=0.14.6
+version=0.13.5
+url=https://releases.hashicorp.com/terraform/${version}/terraform_${version}_linux_amd64.zip
-dl_d=$basedir/.terraform/dl
-zip_file=$dl_d/terraform-${terraform_version}.zip
-unzip_d=$basedir/.terraform/unzip/$terraform_version
-cmd=$unzip_d/terraform
+bin="$basedir/.tmp/$version/terraform"
-if [[ ! -x $cmd ]]
+if [[ ! -x "$bin" ]]
then
- mkdir -p $dl_d
- curl -L -o "$zip_file" $terraform_url
- rm -rf $unzip_d
- mkdir -p $unzip_d
- unzip $zip_file -d $unzip_d
+ mkdir -p $(dirname "$bin")
+ wget -O "$bin.zip" "$url"
+ cd $(dirname "$bin")
+ unzip "$bin.zip" terraform
+ chmod +x terraform
+ cd -
fi
-exec "$cmd" "${@}"
+exec "$bin" "${@}"
diff --git a/terraform/main.tf b/terraform/main.tf
index 74dc140..64803f6 100644
--- a/terraform/main.tf
+++ b/terraform/main.tf
@@ -36,18 +36,6 @@ provider "ansiblevault" {
}
#################################################
-# Linode
-
-data "ansiblevault_path" "linode_token" {
- path = "group_vars/all/linode-dns.yml"
- key = "linode_token_v4"
-}
-
-provider "linode" {
- token = data.ansiblevault_path.linode_token.value
-}
-
-#################################################
# Minio
data "ansiblevault_path" "minio_access_key" {