Terraform provider cache example #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform provider cache example | |
on: | |
workflow_dispatch: | |
jobs: | |
main: | |
name: Example | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: 1.7.5 | |
- name: Configure Terraform plugin cache | |
run: | | |
echo "TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache" >>"$GITHUB_ENV" | |
mkdir --parents "$HOME/.terraform.d/plugin-cache" | |
- name: Cache Terraform | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.terraform.d/plugin-cache | |
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }} | |
restore-keys: | | |
${{ runner.os }}-terraform- | |
- name: Init Terraform configuration | |
run: | | |
terraform init |