-
Notifications
You must be signed in to change notification settings - Fork 4
43 lines (36 loc) · 1.35 KB
/
destroy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Destroy Review Instance
on:
pull_request:
types: [closed]
jobs:
destroy:
name: Destroy
environment:
name: Review
runs-on: ubuntu-latest
concurrency: Review_${{github.event.number}}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: set-up-environment
uses: DFE-Digital/github-actions/set-up-environment@master
- name: Setup Environment Variables
id: variables
run: |
echo "pr_name=${{env.REVIEW_APPLICATION}}-${{github.event.number}}" >> $GITHUB_OUTPUT
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.2.8
- name: Terraform Destroy
run: |
cd terraform/paas && pwd
terraform init -backend-config=review.bk.vars -backend-config="key=${{steps.variables.outputs.pr_name}}.tfstate"
terraform destroy -var-file=review.env.tfvars -auto-approve
env:
ARM_ACCESS_KEY: ${{ secrets.ARM_ACCESS_KEY }}
TF_VAR_AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
- name: Delete Terraform State File
run: az storage blob delete --container-name pass-tfstate --account-name s105d01devstorage --account-key ${{secrets.ARM_ACCESS_KEY}} -n ${{steps.variables.outputs.pr_name}}.tfstate