suzuki-shunsuke / tfaction

Framework for Monorepo to build high level Terraform Workflows by GitHub Actions
https://suzuki-shunsuke.github.io/tfaction/docs/
MIT License
266 stars 40 forks source link

Cache Terraform plugins and modules #1487

Open suzuki-shunsuke opened 8 months ago

suzuki-shunsuke commented 8 months ago

Feature Overview

Cache Terraform plugins and modules

Why is the feature needed?

To speed up CI.

Example Code

No response

Note

rochana-atapattu commented 1 week ago

I am using github/cache action to achieve this (I have not had time to thoroughly asses the impact).

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
   with:
      save-always: true
      path: ~/.local/share/aquaproj-aqua
      key: test-modules-v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('**/aqua/**/*.yaml')}} # Change key
      restore-keys: |
          test-modules-v1-aqua-installer-${{runner.os}}-${{runner.arch}}-

and

- name: Cache Terraform
   uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4
     with:
       path: |
         ${{ steps.target-config.outputs.working_directory }}/.terraform/
       key: ${{ steps.working_directory_name.outputs.working_directory }}-${{ runner.os }}-terraform-${{ hashFiles('${{ steps.target-config.outputs.working_directory }}/.terraform.lock.hcl') }}
       restore-keys: |
         ${{ steps.working_directory_name.outputs.working_directory }}-${{ runner.os }}-terraform-