-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (40 loc) · 1.31 KB
/
main.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
name: 'Deploy to Azure'
on:
push:
branches:
- '*' # Deploy all branches
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 'Login to Azure'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Setup Terraform'
uses: hashicorp/setup-terraform@v1
- name: 'Terraform Init'
run: terraform init
working-directory: ./terraform
- name: 'Terraform Format'
run: terraform fmt -check
working-directory: ./terraform
- name: 'Terraform Plan'
run: terraform plan
working-directory: ./terraform
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
TF_VAR_branch_name: ${{ github.ref_name }}
- name: 'Terraform Apply'
run: terraform apply -auto-approve
working-directory: ./terraform
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
TF_VAR_branch_name: ${{ github.ref_name }}