-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 2.23 KB
/
general.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
---
name: general
"on":
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout source
id: source
uses: actions/checkout@v4
- name: Setup terraform
id: terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform format
id: fmt
run: bin/terraform fmt -no-color -check
- name: Terraform init
id: init
env:
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bin/terraform init -upgrade -no-color -input=false
- name: Terraform validate
id: validate
env:
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bin/terraform validate -no-color
continue-on-error: true
- name: Terraform plan
id: plan
env:
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bin/terraform plan -no-color -input=false
continue-on-error: true
- name: Terraform status
id: status
if: steps.validate.outcome == 'failure' || steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform apply
id: apply
env:
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: bin/terraform apply -no-color -input=false -auto-approve
...