Skip to content

Commit

Permalink
ensure terraform is installed in apply workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ethangardner committed Jan 13, 2025
1 parent 34eb4b0 commit 1d5438a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/_terraform-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- staging
- task/terraform-apply
workflow_dispatch:

jobs:
Expand Down

0 comments on commit 1d5438a

Please sign in to comment.