-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from Constantin07/51-add-example-with-cache
docs(usage): Document an example how to use GH cache for Terraform providers #51
- Loading branch information
Showing
1 changed file
with
39 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
... | ||
``` |