Skip to content

Commit

Permalink
Feat: Updated terraform workflow to stored file to GitHub artifact (#142
Browse files Browse the repository at this point in the history
)

Co-authored-by: Vishwajit Nagulkar <[email protected]>
  • Loading branch information
Tanveer143s and VishwajitNagulkar authored Jul 9, 2024
1 parent 8dafdc1 commit db4c51d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/terraform_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,24 @@ jobs:
terraform apply -auto-approve
fi
- name: Find Errored Terraform State
if: ${{ always() }}
run: |
cd ${{ inputs.working_directory }}
if [ -f "errored.tfstate" ]; then
ls -la errored.tfstate
echo "Uploading errored.tfstate as artifact..."
else
echo "Errored Terraform state file not found."
fi
- name: Upload Errored Terraform State Artifact
if: ${{ always() }} && success() && steps.find_errored_tfstate.outputs['errored_found'] == 'true'
uses: actions/upload-artifact@v4
with:
name: errored_tfstate
path: ${{ inputs.working_directory }}/errored.tfstate

- name: Terraform destroy
if: ${{ inputs.destroy == true }}
id: destroy
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ on:
type: string
default: './examples/complete/'
provider:
required: true
required: false
type: string
default: gcp
description: 'Cloud provider to run the workflow. e.g. azurerm or aws or gcp'
terraform_version:
description: 'Terraform version to use. Leave empty for the latest version.'
Expand Down

0 comments on commit db4c51d

Please sign in to comment.