diff --git a/.circleci/deployment/commands.yml b/.circleci/deployment/commands.yml index ba18f78f8..6debe1027 100644 --- a/.circleci/deployment/commands.yml +++ b/.circleci/deployment/commands.yml @@ -120,10 +120,8 @@ - run: name: Install dependencies command: | - sudo apk update - sudo apk add wget bash python3 py3-pip - sudo pip3 install --upgrade pip - ln -s /usr/bin/python3 /usr/bin/python + sudo apt update + sudo apt-get install -y wget sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_amd64 && chmod +x /usr/local/bin/yq - run: name: Apply database migrations @@ -254,7 +252,10 @@ echo "cf_space_name = \"<>\"" echo "cf_app_name = \"<>\"" } >> ./variables.tfvars - sudo apt-get install -y terraform + - run: + name: Terraform Check + command: | + bash ./scripts/terraform-check.sh - terraform/init: path: <> backend_config_file: ./backend_config.tfvars diff --git a/scripts/terraform-check.sh b/scripts/terraform-check.sh new file mode 100644 index 000000000..07d2d4d7d --- /dev/null +++ b/scripts/terraform-check.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +if command -v terraform /dev/null 2>&1; then + echo The command terraform is available +else +apt-get update && apt-get install -y gnupg software-properties-common + +wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg + +echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list +apt update +apt-get install -y terraform +terraform --version +fi \ No newline at end of file