-
Notifications
You must be signed in to change notification settings - Fork 4
49 lines (42 loc) · 1.56 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
44
45
46
47
48
49
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 Environment variables
shell: bash
run: |
tf_vars_file=terraform/aks/config/review.tfvars.json
terraform_version=$(awk '/{/{f=/^terraform/;next}f' terraform/aks/terraform.tf | grep -o [0-9\.]*)
echo "TERRAFORM_VERSION=$terraform_version" >> $GITHUB_ENV
- name: Use Terraform ${{ env.TERRAFORM_VERSION }}
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- uses: DFE-Digital/github-actions/set-kubelogin-environment@master
with:
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }}
- uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: K8 setup for review apps
shell: bash
run: |
make review get-cluster-credentials PR_NUMBER=${{ github.event.number }}
- name: Terraform Destroy
run: |
make ci review terraform-destroy PR_NUMBER=${{github.event.number}}
- name: Delete Terraform State File
run: az storage blob delete --container-name terraform-state --account-name s189t01gsetfstatervsa --account-key ${{secrets.ARM_ACCESS_KEY}} -n ${{github.event.number}}_kubernetes.tfstate