-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (37 loc) · 1.08 KB
/
terraform.yaml
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
name: 'Terraform Automation'
on:
push:
branches:
- main
pull_request:
jobs:
terraform:
name: 'Build Azure Infra'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Terraform Setup
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Format
id: fmt
run: cd azure && terraform fmt
- name: Terraform init
id: init
run: cd azure && terraform init
- name: Terraform validate
id: validate
run: cd azure && terraform validate
- name: plan
run: cd azure && terraform plan
continue-on-error: true
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.plan.outcome == 'success'
run: cd azure && terraform apply -auto-approve -input=false