Skip to content

Commit 11d68c4

Browse files
committed
allow cache values to be overridable
1 parent 1e88db8 commit 11d68c4

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

action.yml

+32-4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ inputs:
167167
description: "Leverage actions/cache to cache dependencies to speed up execution"
168168
required: false
169169
default: 'false'
170+
terraform-cache-dir:
171+
description: "allows overriding of the terraform cache dir which defaults to ${github.workspace}/cache"
172+
required: false
173+
default: ''
174+
terragrunt-cache-dir:
175+
description: "allows overriding of the terragrunt cache dir to ${github.workspace}/cache"
176+
required: false
177+
default: ''
178+
170179
digger-spec:
171180
description: "(orchestrator only) the spec to pass onto digger cli"
172181
required: false
@@ -369,9 +378,18 @@ runs:
369378
INPUT_DRIFT_DETECTION_SLACK_NOTIFICATION_URL: ${{ inputs.drift-detection-slack-notification-url }}
370379
NO_BACKEND: ${{ inputs.no-backend }}
371380
DEBUG: 'true'
372-
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/cache
381+
# if terraform-cache-dir is set then we set it to that otherwise set it to '${{github.workspace}}/cache'
382+
TF_PLUGIN_CACHE_DIR: ${{
383+
inputs.terraform-cache-dir == '' &&
384+
format('{0}/cache', github.workspace) ||
385+
inputs.terraform-cache-dir
386+
}}
373387
TERRAGRUNT_PROVIDER_CACHE: ${{ inputs.cache-dependencies == 'true' && 1 || 0 }}
374-
TERRAGRUNT_PROVIDER_CACHE_DIR: ${{ github.workspace }}/cache
388+
TERRAGRUNT_PROVIDER_CACHE_DIR: ${{
389+
inputs.terragrunt-cache-dir == '' &&
390+
format('{0}/cache', github.workspace) ||
391+
inputs.terragrunt-cache-dir
392+
}}
375393
DIGGER_RUN_SPEC: ${{inputs.digger-spec}}
376394
run: |
377395
if [[ ${{ inputs.ee }} == "true" ]]; then
@@ -407,9 +425,19 @@ runs:
407425
INPUT_DIGGER_COMMAND: ${{ inputs.command }}
408426
INPUT_DRIFT_DETECTION_SLACK_NOTIFICATION_URL: ${{ inputs.drift-detection-slack-notification-url }}
409427
NO_BACKEND: ${{ inputs.no-backend }}
410-
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/cache
428+
# if terraform-cache-dir is set then we set it to that otherwise set it to '${{github.workspace}}/cache'
429+
TF_PLUGIN_CACHE_DIR: ${{
430+
inputs.terraform-cache-dir == '' &&
431+
format('{0}/cache', github.workspace) ||
432+
inputs.terraform-cache-dir
433+
}}
411434
TERRAGRUNT_PROVIDER_CACHE: ${{ inputs.cache-dependencies == 'true' && 1 || 0 }}
412-
TERRAGRUNT_PROVIDER_CACHE_DIR: ${{ github.workspace }}/cache
435+
# if terragrunt-cache-dir is set then we set it to that otherwise set it to '${{github.workspace}}/cache'
436+
TERRAGRUNT_PROVIDER_CACHE_DIR: ${{
437+
inputs.terragrunt-cache-dir == '' &&
438+
format('{0}/cache', github.workspace) ||
439+
inputs.terragrunt-cache-dir
440+
}}
413441
DIGGER_RUN_SPEC: ${{inputs.digger-spec}}
414442
id: digger
415443
shell: bash

0 commit comments

Comments
 (0)