Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:
required: false

artifact_name:
description: The name of the artifact to upload. If not specified, an artifact name will be generated based on the environment name.
description: The name of the artifact to upload. If not specified, a unique artifact name will be generated.
type: string
required: false

Expand Down Expand Up @@ -107,7 +107,6 @@ env:
LOCK_FILE: .terraform.lock.hcl
PLAN_FILE: tfplan
TARBALL: terraform.tar.gpg
ARTIFACT_NAME: ${{ inputs.artifact_name || format('terraform-{0}', inputs.environment) }}
ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }}

jobs:
Expand Down Expand Up @@ -239,7 +238,7 @@ jobs:
if: steps.tar.outcome == 'success'
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: ${{ env.ARTIFACT_NAME }}
name: ${{ inputs.artifact_name || format('{0}-terraform-{1}', runner.os, hashFiles(inputs.working_directory, inputs.backend_config)) }}
path: ${{ steps.tar.outputs.tarball_path }}
if-no-files-found: error
# Automatically delete artifact after the workflow run time limit (35 days) to save storage space.
Expand Down Expand Up @@ -292,6 +291,7 @@ jobs:
cache-primary-key: ${{ steps.cache-restore.outputs.cache-primary-key }}
cache-restore-hit: ${{ steps.cache-restore.outputs.cache-hit }}
cache-save-outcome: ${{ steps.cache-save.outcome }}
artifact-id: ${{ steps.upload.outputs.artifact-id }}

terraform-apply:
name: Terraform Apply
Expand All @@ -315,7 +315,7 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
name: ${{ env.ARTIFACT_NAME }}
artifact-ids: ${{ needs.terraform-plan.outputs.artifact-id }}
path: ${{ inputs.working_directory }}

- name: Restore cache
Expand Down
2 changes: 1 addition & 1 deletion docs/workflows/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The path, relative to the working directory, of a variable definitions file (`.t

### (*Optional*) `artifact_name`

The name of the artifact to upload. If not specified, an artifact name will be generated based on the environment name. Defaults to `terraform-<environment>`
The name of the artifact to upload. If not specified, a unique artifact name will be generated.

### (*Optional*) `run_terraform_apply`

Expand Down
Loading