Skip to content

Commit

Permalink
Merge pull request #52 from Constantin07/51-add-example-with-cache
Browse files Browse the repository at this point in the history
docs(usage): Document an example how to use GH cache for Terraform providers #51
  • Loading branch information
denis256 authored Mar 21, 2024
2 parents acfff27 + d51110a commit b055fa0
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,42 @@ Example of passing custom code before running Terragrunt:
with:
tg_command: 'plan'
...
```
```

Example of using GitHub cache for Terraform plugins (providers):

```yaml
...
env:
tf_version: 1.5.7
tg_version: 0.53.2
working_dir: project
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache

jobs:
plan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main

- name: Create Terraform Plugin Cache Dir
run: mkdir -p $TF_PLUGIN_CACHE_DIR

- name: Terraform Plugin Cache
uses: actions/[email protected]
with:
path: ${{ env.TF_PLUGIN_CACHE_DIR }}
key: ${{ runner.os }}-terraform-plugin-cache-${{ hashFiles('**/.terraform.lock.hcl') }}

- name: Plan
uses: gruntwork-io/terragrunt-action@v2
env:
TF_PLUGIN_CACHE_DIR: /github/workspace/.terraform.d/plugin-cache
with:
tf_version: ${{ env.tf_version }}
tg_version: ${{ env.tg_version }}
tg_dir: ${{ env.working_dir }}
tg_command: plan
...
```

0 comments on commit b055fa0

Please sign in to comment.