-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (36 loc) · 1.05 KB
/
terraform.yaml
File metadata and controls
46 lines (36 loc) · 1.05 KB
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 Deploy
on:
push:
branches:
- main
paths:
- 'terraform/**'
jobs:
terraform:
name: Terraform Apply
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: eu-west-1
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Init
working-directory: ./terraform
run: terraform init
- name: Terraform Format
working-directory: ./terraform
run: terraform fmt -recursive
- name: Terraform Validate
working-directory: ./terraform
run: terraform validate
- name: Terraform Plan
working-directory: ./terraform
run: terraform plan -out=tfplan
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
working-directory: ./terraform
run: terraform apply -auto-approve tfplan