-
Notifications
You must be signed in to change notification settings - Fork 4
110 lines (107 loc) · 5.2 KB
/
azure-e2e-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: "azure-destroy-workshop-environment"
on:
workflow_dispatch:
inputs:
azure-dns-zone-destroyd:
description: "Whether or not to destroy Azure DNS zones. (Default: true)."
required: true
type: boolean
default: true
baseDomain:
description: "New DNS zone name to destroy (e.g., example.com)"
required: true
domainPrefix:
description: "The subdomain name to destroy on the base domain, (e.g., tap-workshop)"
required: true
participantNumber:
description: "Participant ID (any positive integer)"
required: true
sigResourceGroup:
description: "The name of the resource group the shared image gallery is in"
required: true
default: "toolset"
destroyCoreComponents:
description: Whether or not to also destroy the non participant scoped resources (e.g., shared gallery, dns)
required: true
type: choice
options:
- "no"
- "yes"
jobs:
# we need to destroy key vault due to soft deletes hanging around
destroy-key-vault:
uses: ./.github/workflows/azure-keyvault.yml
with:
resourceGroupName: participant-${{ github.event.inputs.participantNumber }}
action: destroy
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}
destroy-child-dns:
if: github.event.inputs.azure-dns-zone-destroyd == 'true'
uses: ./.github/workflows/azure-child-dns.yml
with:
baseDomain: "${{ github.event.inputs.domainPrefix }}.${{ github.event.inputs.baseDomain }}"
domainPrefix: participant-${{ github.event.inputs.participantNumber }}
mainResourceGroup: main-workshop-dns
resourceGroupName: participant-${{ github.event.inputs.participantNumber }}
action: destroy
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}
destroy-participant-rg:
uses: ./.github/workflows/azure-resource-group.yml
needs: [destroy-child-dns,destroy-key-vault]
with:
resourceGroupName: participant-${{ github.event.inputs.participantNumber }}
action: destroy
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
AZURE_REGION: ${{ secrets.AZURE_REGION }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}
destroy-main-dns-rg:
if: github.event.inputs.destroyCoreComponents == 'yes' && github.event.inputs.azure-dns-zone-destroyd == 'true'
uses: ./.github/workflows/azure-resource-group.yml
with:
resourceGroupName: main-workshop-dns
action: destroy
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
AZURE_REGION: ${{ secrets.AZURE_REGION }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}
destroy-gallery-rg:
uses: ./.github/workflows/azure-resource-group.yml
# needs: destroy-shared-gallery-image-def
if: github.event.inputs.destroyCoreComponents == 'yes'
with:
resourceGroupName: ${{ github.event.inputs.sigResourceGroup }}
action: destroy
secrets:
AZURE_AD_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
AZURE_AD_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_AD_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
AZURE_REGION: ${{ secrets.AZURE_REGION }}
TF_BACKEND_RESOURCE_GROUP_NAME: ${{ secrets.TF_BACKEND_RESOURCE_GROUP_NAME }}
TF_BACKEND_STORAGE_ACCOUNT_NAME: ${{ secrets.TF_BACKEND_STORAGE_ACCOUNT_NAME }}
TF_BACKEND_STORAGE_CONTAINER_NAME: ${{ secrets.TF_BACKEND_STORAGE_CONTAINER_NAME }}