Skip to content

Commit

Permalink
caching example
Browse files Browse the repository at this point in the history
Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
  • Loading branch information
rdhar committed Oct 21, 2024
1 parent bb9a7d8 commit 81c0554
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/examples/pr_push_auth.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Trigger on pull_request (plan) and push (apply) events with Terraform and AWS authentication.
name: Trigger on pull_request (plan) and push (apply) events with Terraform, AWS authentication and caching.

on:
pull_request:
Expand Down Expand Up @@ -27,6 +27,17 @@ jobs:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_ROLE }}

- name: Create cache
run: |
mkdir --parents $HOME/.terraform.d/plugin-cache
echo "TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache" >> $GITHUB_ENV
- name: Cache TF
uses: actions/cache@v4
with:
path: ~/.terraform.d/plugin-cache
key: cache-tf-${{ runner.os }}-${{ hashFiles('path/to/directory/.terraform.lock.hcl') }}

- name: Setup TF
uses: hashicorp/setup-terraform@v3

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The following workflows showcase common use cases, while a comprehensive list of
<table>
<tr>
<td>
<a href="/.github/examples/pr_push_auth.yaml">Run on</a> <code>pull_request</code> (plan) and <code>push</code> (apply) events with Terraform and AWS <strong>authentication</strong>.
<a href="/.github/examples/pr_push_auth.yaml">Run on</a> <code>pull_request</code> (plan) and <code>push</code> (apply) events with Terraform, AWS <strong>authentication</strong> and <strong>caching</strong>.
</td>
<td>
<a href="/.github/examples/pr_merge_matrix.yaml">Run on</a> <code>pull_request</code> (plan) and <code>merge_group</code> (apply) events with OpenTofu in <strong>matrix</strong> strategy.
Expand Down

0 comments on commit 81c0554

Please sign in to comment.