-
Notifications
You must be signed in to change notification settings - Fork 68
63 lines (55 loc) · 1.84 KB
/
bicep-what-if.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
---
name: Bicep What If
on:
pull_request:
branches:
- main
paths:
- 'dev-infrastructure/**/*.bicep'
- '.github/workflows/bicep-what-if.yml'
jobs:
what-if:
permissions:
id-token: 'write'
contents: 'read'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 1
- name: 'Az CLI login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Deployment What If'
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
RESOURCEGROUP=${GITHUB_RUN_ID}
cd dev-infrastructure/
az group create -g "${RESOURCEGROUP}" -l eastus
# service cluster
az deployment group what-if \
--name "${GITHUB_RUN_ID}" \
--resource-group "${RESOURCEGROUP}" \
--template-file templates/svc-cluster.bicep \
--parameters configurations/svc-cluster.bicepparam \
--parameters currentUserId="${GITHUB_ACTOR}"
# management cluster
az deployment group what-if \
--name "${GITHUB_RUN_ID}" \
--resource-group "${RESOURCEGROUP}" \
--template-file templates/mgmt-cluster.bicep \
--parameters configurations/mgmt-cluster.bicepparam \
--parameters currentUserId="${GITHUB_ACTOR}"
- name: 'Clean Up'
uses: azure/cli@v2
if: always()
with:
azcliversion: latest
inlineScript: |
RESOURCEGROUP=${GITHUB_RUN_ID}
az group delete -g "${RESOURCEGROUP}" -y