From 8150660724c1a9c50363f73b2db577c5da64f468 Mon Sep 17 00:00:00 2001 From: Ethan Gardner Date: Tue, 14 Jan 2025 14:15:57 -0500 Subject: [PATCH] ensure terraform is installed in apply workflow (#439) * ensure terraform is installed in apply workflow * revert testing workflow in prep for launch --- .github/workflows/_terraform-apply.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/_terraform-apply.yml b/.github/workflows/_terraform-apply.yml index 45068011..abadba11 100644 --- a/.github/workflows/_terraform-apply.yml +++ b/.github/workflows/_terraform-apply.yml @@ -6,6 +6,11 @@ on: deploy-env: type: string required: true + terraform_version: + description: Terraform version + required: false + default: "1.10.4" + type: string env: DEPLOY_ENV: ${{ inputs.deploy-env }} @@ -50,6 +55,24 @@ jobs: - name: Install dependencies run: pnpm install + - uses: actions/cache@v3 + name: Check Cache for Terraform CLI + id: terraform-cache + with: + path: /usr/local/bin/terraform + key: terraform-${{ inputs.terraform_version }} + + - name: Install Terraform CLI + if: steps.terraform-cache.outputs.cache-hit != 'true' + run: | + sudo apt-get update && sudo apt-get install -y wget unzip + wget https://releases.hashicorp.com/terraform/${{ inputs.terraform_version }}/terraform_${{ inputs.terraform_version }}_linux_amd64.zip + unzip terraform_${{ inputs.terraform_version }}_linux_amd64.zip + sudo mv terraform /usr/local/bin/ + + - name: Verify Terraform Installation + run: terraform --version + - name: Initialize Terraform CDK configuration shell: bash working-directory: infra/cdktf